Class: SavonHelper::FloatMapping
- Inherits:
-
TypeMapping
- Object
- TypeMapping
- SavonHelper::FloatMapping
- Defined in:
- lib/savon_helper/type_mappings.rb
Overview
FloatMapping maps Savon data to Ruby floats.
Converting collapse
-
#to_native(data) ⇒ Float
Convert from Savon data to Ruby floats.
-
#to_savon(value) ⇒ String
Convert from Ruby float type to Savon data.
Instance Method Summary collapse
- #default_value ⇒ Object abstract
-
#object_klass ⇒ Float
Return the class represented by the mapping.
-
#type_string ⇒ String
Return the class description represented by the mapping.
Methods inherited from TypeMapping
#description, #initialize, #warn_unparseable_data
Constructor Details
This class inherits a constructor from SavonHelper::TypeMapping
Instance Method Details
#default_value ⇒ Object
This method is abstract.
Return the default value the mapping.
187 188 189 |
# File 'lib/savon_helper/type_mappings.rb', line 187 def default_value 0.0 end |
#object_klass ⇒ Float
Return the class represented by the mapping.
175 176 177 |
# File 'lib/savon_helper/type_mappings.rb', line 175 def object_klass Float end |
#to_native(data) ⇒ Float
Convert from Savon data to Ruby floats
160 161 162 |
# File 'lib/savon_helper/type_mappings.rb', line 160 def to_native(data) data.to_f end |
#to_savon(value) ⇒ String
Convert from Ruby float type to Savon data
167 168 169 |
# File 'lib/savon_helper/type_mappings.rb', line 167 def to_savon(value) value.to_s end |
#type_string ⇒ String
Return the class description represented by the mapping.
181 182 183 |
# File 'lib/savon_helper/type_mappings.rb', line 181 def type_string "float" end |