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.
Instance Attribute Summary
Attributes inherited from TypeMapping
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
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.
174 175 176 |
# File 'lib/savon_helper/type_mappings.rb', line 174 def default_value 0.0 end |
#object_klass ⇒ Float
Return the class represented by the mapping.
162 163 164 |
# File 'lib/savon_helper/type_mappings.rb', line 162 def object_klass Float end |
#to_native(data) ⇒ Float
Convert from Savon data to Ruby floats
147 148 149 |
# File 'lib/savon_helper/type_mappings.rb', line 147 def to_native(data) data.to_f end |
#to_savon(value) ⇒ String
Convert from Ruby float type to Savon data
154 155 156 |
# File 'lib/savon_helper/type_mappings.rb', line 154 def to_savon(value) value.to_s end |
#type_string ⇒ String
Return the class description represented by the mapping.
168 169 170 |
# File 'lib/savon_helper/type_mappings.rb', line 168 def type_string "float" end |