# class Attributes

Extends Hash

A class that holds the Attributes of an Element.

## Methods

- []
- []=
- add
- delete
- delete_all
- each_attribute
- get_attribute
- initialize
- literalize
- prefixes

## Aliases

### <<

is a synonym for

### add

## Methods

### []

#### Arguments

name
an XPath attribute name
Returns A String, which is the value of the first matching attribute, or nil if there was none

Fetches an attribute value. If you want to get the Attribute itself, use get_attribute()

### []=

#### Arguments

name
the name of the attribute
value<nil>
(optional) If supplied, the value of the attribute. If nil, any existing matching attribute is deleted.
Returns self NOTE that unlike most REXML methods, this does not return the set Attribute.

Sets an attribute, overwriting any existing attribute value by the same name

### add

#### Arguments

attribute
must be an Attribute

Adds an attribute, overriding any existing attribute by the same name.

### delete

#### Arguments

attribute
Returns the removed attribute

Removes an attribute

### delete_all

#### Arguments

xpath
A String; all attributes that match this path will be removed
Returns an Array of the Attributes that were removed

DO NOT USE THIS METHOD! It WILL fail, and may be removed. If you absolutely need this method, write the author. Deletes all attributes matching an xpath

### each_attribute

### get_attribute

#### Arguments

name
the XPath by which to search for the attribute
Returns The first matching Attribute, or nil if there was none

Fetches an attribute

### initialize

#### Arguments

element
the Element of which this is an Attribute

Constructor

### literalize

#### Arguments

name

Private helper class.

### prefixes