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

#infinity, #simplified_type

Instance Method Details

#typeObject



262
# File 'lib/arjdbc/postgresql/base/oid.rb', line 262

def type; :float end

#type_cast(value) ⇒ Object



264
265
266
267
268
269
270
271
272
273
# File 'lib/arjdbc/postgresql/base/oid.rb', line 264

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