Class: OvhRb::OvhObject

Inherits:
Object
  • Object
show all
Includes:
Converter
Defined in:
lib/ovhrb/ovh_object.rb

Instance Method Summary collapse

Constructor Details

#initialize(object) ⇒ OvhObject

Returns a new instance of OvhObject.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ovhrb/ovh_object.rb', line 5

def initialize(object)
  object.__xmlele.each do |attr, value|
    value = convert_to_ovh_object(value)
    
    attr_name = attr.name.underscore
    instance_variable_set("@#{attr_name}", value)
    unless self.class.method_defined?(attr_name)
      self.class.class_eval do
        define_method(attr_name) { instance_variable_get("@#{attr_name}") }
      end
    end
  end
end