Class: AcDc::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/acdc/attribute.rb

Overview

Attribute object used in Element and Body. Not often used outside of these.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ Attribute

Returns a new instance of Attribute.



9
10
11
12
# File 'lib/acdc/attribute.rb', line 9

def initialize(name,value)
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/acdc/attribute.rb', line 7

def name
  @name
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/acdc/attribute.rb', line 7

def value
  @value
end

Instance Method Details

#to_hashObject

Returns the values of this attribute in hash form



15
16
17
# File 'lib/acdc/attribute.rb', line 15

def to_hash
  {@name => @value}
end