Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID::Float

Inherits:
Type
  • Object
show all
Defined in:
lib/active_record/connection_adapters/postgresql/oid.rb

Instance Method Summary collapse

Methods inherited from Type

#type

Instance Method Details

#type_cast(value) ⇒ Object



212
213
214
215
216
217
218
219
220
221
# File 'lib/active_record/connection_adapters/postgresql/oid.rb', line 212

def type_cast(value)
  case value
    when nil;         nil
    when 'Infinity';  ::Float::INFINITY
    when '-Infinity'; -::Float::INFINITY
    when 'NaN';       ::Float::NAN
  else
    value.to_f
  end
end