Class: ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Float

Inherits:
Type
  • Object
show all
Defined in:
lib/arjdbc/postgresql/base/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/arjdbc/postgresql/base/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