Class | Sequel::Postgres::InetOp |
In: |
lib/sequel/extensions/pg_inet_ops.rb
|
Parent: | Sequel::SQL::Wrapper |
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 |
<< | -> | contained_by |
>> | -> | contains |
For String and IPAddr instances, wrap them in a cast to inet, to avoid ambiguity issues when calling operator methods.
# 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
Return an expression for the subtraction of the argument from the receiver
# 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.
# 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
# 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