Class: REXML::Attributes

Inherits:
Object
  • Object
show all
Defined in:
lib/sixarm_ruby_rexml/attributes.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) to_a_hash

A new hash of the attributes' name and value pairs.

Examples:

attributes.to_a_hash => {"src"=>"pic.jpg", "height" => "100", "width" => "200"} 

Returns:

  • a new hash of the attributes' name and value pairs.



8
9
10
# File 'lib/sixarm_ruby_rexml/attributes.rb', line 8

def to_a_hash
  to_a.inject({}){|hash, attribute| hash[attribute.name]=attribute.value; hash}
end