Class: SavonHelper::BooleanMapping
- Inherits:
-
TypeMapping
- Object
- TypeMapping
- SavonHelper::BooleanMapping
- Defined in:
- lib/savon_helper/type_mappings.rb
Overview
BooleanMapping maps Savon data to Ruby Booleans.
Converting collapse
-
#to_native(data, interface) ⇒ Boolean
Convert from Savon data to Ruby Boolean.
-
#to_savon(value) ⇒ String
Convert from Ruby Boolean type to Savon data.
Instance Method Summary collapse
- #default_value ⇒ Object abstract
-
#object_klass ⇒ TrueClass
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.
105 106 107 |
# File 'lib/savon_helper/type_mappings.rb', line 105 def default_value false end |
#object_klass ⇒ TrueClass
Return the class represented by the mapping.
93 94 95 |
# File 'lib/savon_helper/type_mappings.rb', line 93 def object_klass TrueClass end |
#to_native(data, interface) ⇒ Boolean
Convert from Savon data to Ruby Boolean
77 78 79 |
# File 'lib/savon_helper/type_mappings.rb', line 77 def to_native(data, interface) data.to_s == "true" end |
#to_savon(value) ⇒ String
Convert from Ruby Boolean type to Savon data
84 85 86 |
# File 'lib/savon_helper/type_mappings.rb', line 84 def to_savon(value) value.to_s end |
#type_string ⇒ String
Return the class description represented by the mapping.
99 100 101 |
# File 'lib/savon_helper/type_mappings.rb', line 99 def type_string "bool" end |