Class Sequel::Postgres::InetOp
In: lib/sequel/extensions/pg_inet_ops.rb
Parent: Sequel::SQL::Wrapper

The InetOp class is a simple container for a single object that defines methods that yield Sequel expression objects representing PostgreSQL inet operators and functions.

Most methods in this class are defined via metaprogramming, see the pg_inet_ops extension documentation for details on the API.

Methods

-   new   pg_inet   set_masklen   ~  

Included Modules

Sequel::SQL::BitwiseMethods

Constants

OPERATORS = { :contained_by_or_equals => ["(".freeze, " <<= ".freeze, ")".freeze].freeze, :contains_or_equals => ["(".freeze, " >>= ".freeze, ")".freeze].freeze, :contains_or_contained_by => ["(".freeze, " && ".freeze, ")".freeze].freeze, }.freeze

External Aliases

<< -> contained_by
>> -> contains

Public Class methods

For String and IPAddr instances, wrap them in a cast to inet, to avoid ambiguity issues when calling operator methods.

[Source]

    # File lib/sequel/extensions/pg_inet_ops.rb, line 77
77:       def initialize(v)
78:         case v
79:         when ::Sequel::LiteralString
80:           # nothing
81:         when String, IPAddr
82:           v = Sequel.cast(v, :inet)
83:         end
84:         super
85:       end

Public Instance methods

Return an expression for the subtraction of the argument from the receiver

[Source]

     # File lib/sequel/extensions/pg_inet_ops.rb, line 128
128:       def -(v)
129:         case v
130:         when Integer
131:           self.class.new(super)
132:         else
133:           Sequel::SQL::NumericExpression.new(:NOOP, super)
134:         end
135:       end

Return the receiver.

[Source]

     # File lib/sequel/extensions/pg_inet_ops.rb, line 118
118:       def pg_inet
119:         self
120:       end

Return an expression for the calling of the set_masklen function with the receiver and the given argument

[Source]

     # File lib/sequel/extensions/pg_inet_ops.rb, line 138
138:       def set_masklen(v)
139:         self.class.new(Sequel::SQL::Function.new(:set_masklen, self, v))
140:       end

Return an expression for the bitwise NOT of the receiver

[Source]

     # File lib/sequel/extensions/pg_inet_ops.rb, line 123
123:       def ~
124:         self.class.new(super)
125:       end

[Validate]