Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Range
- Inherits:
-
Type
- Object
- Type
- ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Range
show all
- Defined in:
- activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Type
#type, #type_cast_for_write
Constructor Details
#initialize(subtype) ⇒ Range
Returns a new instance of Range.
104
105
106
|
# File 'activerecord/lib/active_record/connection_adapters/postgresql/oid.rb', line 104
def initialize(subtype)
@subtype = subtype
end
|
Instance Attribute Details
Returns the value of attribute subtype
103
104
105
|
# File 'activerecord/lib/active_record/connection_adapters/postgresql/oid.rb', line 103
def subtype
@subtype
end
|
Instance Method Details
108
109
110
111
112
113
114
115
116
|
# File 'activerecord/lib/active_record/connection_adapters/postgresql/oid.rb', line 108
def (value)
from, to = value[1..-2].split(',')
{
from: (value[1] == ',' || from == '-infinity') ? infinity(:negative => true) : from,
to: (value[-2] == ',' || to == 'infinity') ? infinity : to,
exclude_start: (value[0] == '('),
exclude_end: (value[-1] == ')')
}
end
|
#infinity(options = {}) ⇒ Object
118
119
120
|
# File 'activerecord/lib/active_record/connection_adapters/postgresql/oid.rb', line 118
def infinity(options = {})
::Float::INFINITY * (options[:negative] ? -1 : 1)
end
|
#infinity?(value) ⇒ Boolean
122
123
124
|
# File 'activerecord/lib/active_record/connection_adapters/postgresql/oid.rb', line 122
def infinity?(value)
value.respond_to?(:infinite?) && value.infinite?
end
|
#to_integer(value) ⇒ Object
126
127
128
|
# File 'activerecord/lib/active_record/connection_adapters/postgresql/oid.rb', line 126
def to_integer(value)
infinity?(value) ? value : value.to_i
end
|