Add multiple attributes to this element.
 hash:: is either a hash, or array of arrays
  el.add_attributes( {"name1"=>"value1", "name2"=>"value2"} )
  el.add_attributes( [ ["name1","value1"], ["name2"=>"value2"] ] )
334100
def add_attributes hash
      if hash.kind_of? Hash
        hash.each_pair {|key, value| @attributes[key] = value }
      elsif hash.kind_of? Array
        hash.each { |value| @attributes[ value[0] ] = value[1] }
      end
    end
384269
def attributes
      attrs = Hash.new
      attribute_list.each do |attribute|
        value = self.send(attribute)
        attrs[attribute] = value unless value.nil?
      end
      attrs
    end
1118749
def add_attribute(name, value, options={})
      new_representor_hash = RepresentorHash.new(deep_dup(@representor_hash.to_h))
      new_representor_hash.attributes[name] = options.merge({value: value})
      RepresentorBuilder.new(new_representor_hash)
    end
476258
def _insert_attributes(attrs, order=[])
      return if attrs.nil?
      order.each do |k|
        v = attrs[k]
        @target << %{ #{k}=#{@quote}#{_attr_value(v)}#{@quote}} if v
      end
      attrs.each do |k, v|
        @target << %{ #{k}=#{@quote}#{_attr_value(v)}#{@quote}} unless order.member?(k) # " WART
      end
    end
336247
def update_attributes(attributes)
      attributes.each { |attribute, value| write_attribute(attribute, value) }
      save
    end
464045
def attribute(*args)
      node = Nodes::Attribute.new

      if args.first.is_a?(Hash)
        args.first.each_pair { |k, v| node[v] = k }
      else
        options = args.extract_options!
        args.each { |name|
          key = options[:as] || name
          node[key] = name
        }
        node.condition = options[:if]
      end

      @template.add_node node
    end
799370
def add(attributes)
      level = attributes[:level].to_sym

      if valid_level?(level)
        entries << Entry.new(attributes)
      end
    end
1237535
def to_hash
      hash = {}
      ATTRS.each do |attribute|
        hash[attribute] = self.send(attribute)
      end

      hash
    end
1230386
def to_hash
      hash = {}
      attributes = self.class.attribute_map.sort_by {|key,value| key}
      attributes.each { |attr, param|
        value = self.send(attr)
        next if value.nil?
        if value.is_a?(Array)
          hash[param] = value.compact.map{ |v| _to_hash(v) }
        else
          hash[param] = _to_hash(value)
        end
      }
      hash
    end
1224406
def array(attr, metadata={})
      add_attribute(attr, :array, metadata)
      define_method("#{attr}=") do |arg|
        instance_variable_set("@#{attr}", Array(arg))
      end
    end
1366131
def attributes
      fields.each_with_object(HashWithIndifferentAccess.new) do |field, acc|
        acc[field.alias] = field.value
      end
    end
299901
def offset_attribute(hash, offset=nil)
      offset_attr_accessor(hash, offset)
      hash.each { |ja, original| add_attribute(ja, property(original).type) }
    end
792600
def add_has_manys(row, attrs)
      headers_length = row.headers.compact.length
      pairs_start_on_evens = headers_length.even?
      (headers_length..row.fields.length).each do |i|
        i.send(pairs_start_on_evens ? :even? : :odd?) || next
        row[i] || next

        m = row[i].match(/^(\w+)_(\d+)_(\w+)$/)
        m || next
        has_many_name = m[1].pluralize
        has_many_index = m[2].to_i
        has_many_field = m[3]
        has_many_value = row[i + 1]

        has_many_config = @config.has_manys[has_many_name.to_sym]

        next unless has_many_config
        next unless has_many_config.fields.include?(has_many_field.to_sym)
        next if has_many_config.export_only_fields.include?(has_many_field.to_sym)

        attrs[has_many_name] ||= []
        attrs[has_many_name][has_many_index] ||= {}
        attrs[has_many_name][has_many_index][has_many_field] = has_many_value
      end
    end
596836
def to_hash
      hash = {}
      self.class.attribute_map.each_pair do |attr, param|
        value = self.send(attr)
        next if value.nil?
        hash[param] = _to_hash(value)
      end
      hash
    end
879868
def attribute(*args)
      if args.first.is_a?(Hash)
        args.first.each_pair do |key, name|
          @attributes.add(name: name, attr: key)
        end
      else
        options = args.extract_options!
        args.each do |name|
          key = options[:as] || name
          @attributes.add(name: name, attr: key)
        end
      end
    end
701041
def synced_attributes_as_hash(attributes)
      return attributes if attributes.is_a?(Hash)
      Hash[Array.wrap(attributes).map { |name| [name, name] }]
    end
1361623
def extend(self, **attributes):
        
        for key, value in attributes.iteritems():
            if not hasattr(self, key):
                setattr(self, key, value)