Class: WsdlMapper::Deserializers::PropMapping

Inherits:
AttrMapping
  • Object
show all
Defined in:
lib/wsdl_mapper/deserializers/prop_mapping.rb

Instance Attribute Summary

Attributes inherited from AttrMapping

#accessor, #name, #type_name

Instance Method Summary collapse

Methods inherited from AttrMapping

#get, #getter, #setter

Constructor Details

#initialize(*args, array: false) ⇒ PropMapping

Returns a new instance of PropMapping.



6
7
8
9
# File 'lib/wsdl_mapper/deserializers/prop_mapping.rb', line 6

def initialize(*args, array: false)
  super(*args)
  @array = array
end

Instance Method Details

#array?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/wsdl_mapper/deserializers/prop_mapping.rb', line 11

def array?
  !!@array
end

#set(obj, value) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/wsdl_mapper/deserializers/prop_mapping.rb', line 15

def set(obj, value)
  if array?
    obj.send setter, obj.send(getter) || []
    obj.send(getter) << value
  else
    super
  end
end