Class: SavonHelper::IntegerMapping
- Inherits:
-
TypeMapping
- Object
- TypeMapping
- SavonHelper::IntegerMapping
- Defined in:
- lib/savon_helper/type_mappings.rb
Overview
IntegerMapping maps Savon data to Ruby integers.
Converting collapse
-
#to_native(data, interface) ⇒ Integer
Convert from Savon data to Ruby integers.
-
#to_savon(value) ⇒ String
Convert from Ruby float type to Savon data.
Instance Method Summary collapse
- #default_value ⇒ Object abstract
-
#object_klass ⇒ Integer
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.
146 147 148 |
# File 'lib/savon_helper/type_mappings.rb', line 146 def default_value 0 end |
#object_klass ⇒ Integer
Return the class represented by the mapping.
134 135 136 |
# File 'lib/savon_helper/type_mappings.rb', line 134 def object_klass Integer end |
#to_native(data, interface) ⇒ Integer
Convert from Savon data to Ruby integers
119 120 121 |
# File 'lib/savon_helper/type_mappings.rb', line 119 def to_native(data, interface) Integer(data.to_s) end |
#to_savon(value) ⇒ String
Convert from Ruby float type to Savon data
126 127 128 |
# File 'lib/savon_helper/type_mappings.rb', line 126 def to_savon(value) value.to_s end |
#type_string ⇒ String
Return the class description represented by the mapping.
140 141 142 |
# File 'lib/savon_helper/type_mappings.rb', line 140 def type_string "int" end |