class Torque::PostgreSQL::Adapter::OID::Range
Constants
- HASH_PICK
Public Instance Methods
cast_value(value)
click to toggle source
Calls superclass method
# File lib/torque/postgresql/adapter/oid/range.rb, line 18 def cast_value(value) case value when Array cast_custom(value[0], value[1]) when Hash pieces = value.with_indifferent_access.values_at(*HASH_PICK) cast_custom(pieces[0] || pieces[1], pieces[2] || pieces[3]) else super end end
Private Instance Methods
cast_custom(from, to)
click to toggle source
# File lib/torque/postgresql/adapter/oid/range.rb, line 39 def cast_custom(from, to) from = custom_cast_single(from, true) to = custom_cast_single(to) ::Range.new(from, to) end
custom_cast_single(value, negative = false)
click to toggle source
# File lib/torque/postgresql/adapter/oid/range.rb, line 45 def custom_cast_single(value, negative = false) value.blank? ? custom_infinity(negative) : subtype.deserialize(value) end
custom_infinity(negative)
click to toggle source
# File lib/torque/postgresql/adapter/oid/range.rb, line 49 def custom_infinity(negative) negative ? -::Float::INFINITY : ::Float::INFINITY end