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.
Instance Attribute Summary
Attributes inherited from TypeMapping
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
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.
92 93 94 |
# File 'lib/savon_helper/type_mappings.rb', line 92 def default_value false end |
#object_klass ⇒ TrueClass
Return the class represented by the mapping.
80 81 82 |
# File 'lib/savon_helper/type_mappings.rb', line 80 def object_klass TrueClass end |
#to_native(data, interface) ⇒ Boolean
Convert from Savon data to Ruby Boolean
64 65 66 |
# File 'lib/savon_helper/type_mappings.rb', line 64 def to_native(data, interface) data.to_s == "true" end |
#to_savon(value) ⇒ String
Convert from Ruby Boolean type to Savon data
71 72 73 |
# File 'lib/savon_helper/type_mappings.rb', line 71 def to_savon(value) value.to_s end |
#type_string ⇒ String
Return the class description represented by the mapping.
86 87 88 |
# File 'lib/savon_helper/type_mappings.rb', line 86 def type_string "bool" end |