Class: Wrest::Components::Mutators::XmlSimpleTypeCaster
- Defined in:
- lib/wrest/components/mutators/xml_simple_type_caster.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Wrest::Components::Mutators::Base
Instance Method Details
#do_mutate(tuple) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/wrest/components/mutators/xml_simple_type_caster.rb', line 16 def do_mutate(tuple) out_key = tuple.first in_value = tuple.last[0] out_value = in_value case in_value when Hash if in_value['nil'] == 'true' out_value = nil elsif in_value.key?('type') out_value = ActiveSupport::CoreExtensions::Hash::Conversions::XML_PARSING[in_value['type']].call(in_value['content']) else out_value = in_value.mutate_using(self) end end [out_key, out_value] end |