Class: IControl::Base::Enumeration

Inherits:
Object
  • Object
show all
Defined in:
lib/icontrol/base/enumeration.rb

Class Method Summary collapse

Class Method Details

.from_soap(value) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/icontrol/base/enumeration.rb', line 5

def from_soap(value)
  
  # WorkArround when there are two  values with the same key (even if this one is an attribute) the hash contains an array of values, 
  # instead of just one value. In this case we choose the one that does not starts with iControl (cause this usually happends when
  # type clashes with the attribute class type) this happends when calling IControl::LocalLB::Pool#monitor_association for example

  value = value.find { |i| i =~ /^[^iControl].*/ } if value.respond_to?(:find)

  return nil unless value
  return class_eval "#{self.name}::#{[*value].last}"
end