Method: Xampl::XamplObject#init_attributes

Defined in:
lib/xamplr/xampl-object.rb

#init_attributes(attr_name, attr_namespace, attr_value) ⇒ Object



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/xamplr/xampl-object.rb', line 81

def init_attributes(attr_name, attr_namespace, attr_value)
  return unless attr_name

  attr_name.each_index do |i|
    self.attributes.each do |attr_spec|
      if (2 == attr_spec.size) then
        if (attr_spec[1] == attr_name[i]) then
          self.instance_variable_set(attr_spec[0], attr_value[i])
        end
      else
        if ((attr_spec[1] == attr_name[i]) and (attr_spec[2] == attr_namespace[i])) then
          self.instance_variable_set(attr_spec[0], attr_value[i])
        end
      end
    end
  end
end