Class: Superstore::Types::FloatType

Inherits:
BaseType
  • Object
show all
Defined in:
lib/superstore/types/float_type.rb

Instance Attribute Summary

Attributes inherited from BaseType

#model, #options

Instance Method Summary collapse

Methods inherited from BaseType

#initialize

Constructor Details

This class inherits a constructor from Superstore::Types::BaseType

Instance Method Details

#decode(str) ⇒ Object



8
9
10
# File 'lib/superstore/types/float_type.rb', line 8

def decode(str)
  str.to_f unless str.empty?
end

#encode(float) ⇒ Object



4
5
6
# File 'lib/superstore/types/float_type.rb', line 4

def encode(float)
  float
end

#typecast(value) ⇒ Object



12
13
14
# File 'lib/superstore/types/float_type.rb', line 12

def typecast(value)
  value.to_f
end