Class: ActiveRecord::ConnectionAdapters::Redshift::OID::Float

Inherits:
Type::Float
  • Object
show all
Includes:
Infinity
Defined in:
lib/active_record/connection_adapters/redshift/oid/float.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from Infinity

#infinity

Instance Method Details

#cast_value(value) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/active_record/connection_adapters/redshift/oid/float.rb', line 8

def cast_value(value)
  case value
  when ::Float then     value
  when 'Infinity' then  ::Float::INFINITY
  when '-Infinity' then -::Float::INFINITY
  when 'NaN' then       ::Float::NAN
  else                  value.to_f
  end
end