Module: Unidata::Extensions::Float

Included in:
Float
Defined in:
lib/unidata/extensions/float.rb

Instance Method Summary collapse

Instance Method Details

#from_unidata(value) ⇒ Object



12
13
14
# File 'lib/unidata/extensions/float.rb', line 12

def from_unidata(value)
  typecast(value) / 100
end

#to_unidata(value) ⇒ Object



8
9
10
# File 'lib/unidata/extensions/float.rb', line 8

def to_unidata(value)
  (value * 100).to_i
end

#typecast(value) ⇒ Object



4
5
6
# File 'lib/unidata/extensions/float.rb', line 4

def typecast(value)
  value.kind_of?(::Float) ? value : value.to_f
end