Class: SavonHelper::TypeMapping
- Defined in:
- lib/savon_helper/type_mappings.rb
Overview
A TypeMapping class is responsible for converting between Savon primitive types and Ruby Types
Direct Known Subclasses
ArrayMapping, BooleanMapping, DatetimeMapping, EnumMapping, FloatMapping, HintMapping, IntegerMapping, MissingMapping, StringMapping
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Converting collapse
- #to_native(data) ⇒ Object abstract
- #to_savon(value) ⇒ Object abstract
Instance Method Summary collapse
- #default_value ⇒ Object abstract
-
#initialize(name = '', description = '') ⇒ TypeMapping
constructor
A new instance of TypeMapping with description.
- #object_klass ⇒ Class abstract
- #type_string ⇒ String abstract
Constructor Details
#initialize(name = '', description = '') ⇒ TypeMapping
A new instance of TypeMapping with description
13 14 15 16 |
# File 'lib/savon_helper/type_mappings.rb', line 13 def initialize(name='', description='') @name = name @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
8 9 10 |
# File 'lib/savon_helper/type_mappings.rb', line 8 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/savon_helper/type_mappings.rb', line 8 def name @name end |
Instance Method Details
#default_value ⇒ Object
This method is abstract.
Return the default value the mapping.
50 51 52 |
# File 'lib/savon_helper/type_mappings.rb', line 50 def default_value raise "#{self.class}##{__method__}() not implemented!" end |
#object_klass ⇒ Class
This method is abstract.
Return the class represented by the mapping.
38 39 40 |
# File 'lib/savon_helper/type_mappings.rb', line 38 def object_klass raise "#{self.class}##{__method__}() not implemented!" end |
#to_native(data) ⇒ Object
This method is abstract.
Convert from Savon data to Ruby value
23 24 25 |
# File 'lib/savon_helper/type_mappings.rb', line 23 def to_native(data) raise "#{self.class}##{__method__}(#{data.inspect}) not implemented!" end |
#to_savon(value) ⇒ Object
This method is abstract.
Convert from Ruby value type to Savon data
30 31 32 |
# File 'lib/savon_helper/type_mappings.rb', line 30 def to_savon(value) raise "#{self.class}##{__method__}(#{value.inspect}) not implemented!" end |
#type_string ⇒ String
This method is abstract.
Return the class description represented by the mapping.
44 45 46 |
# File 'lib/savon_helper/type_mappings.rb', line 44 def type_string raise "#{self.class}##{__method__}() not implemented!" end |