Class: Wrest::Components::Mutators::XmlTypeCaster

Inherits:
Base
  • Object
show all
Defined in:
lib/wrest/components/mutators/xml_type_caster.rb

Instance Attribute Summary

Attributes inherited from Base

#next_mutator

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize, #mutate

Constructor Details

This class inherits a constructor from Wrest::Components::Mutators::Base

Instance Method Details

#do_mutate(tuple) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/wrest/components/mutators/xml_type_caster.rb', line 20

def do_mutate(tuple)
  out_key, in_value = tuple

  out_value = case in_value
              when Hash
                process_hash_value(in_value)
              when Array
                in_value.collect { |hash| hash.mutate_using(self) }
              else
                in_value
              end

  [out_key, out_value]
end