Class: HOM::AttributeList
- Inherits:
-
Object
- Object
- HOM::AttributeList
- Defined in:
- lib/hom.rb
Instance Method Summary collapse
-
#initialize ⇒ AttributeList
constructor
A new instance of AttributeList.
- #set(name, value = Undefined) ⇒ Object
- #to_hash ⇒ Object
- #update(object) ⇒ Object
Constructor Details
#initialize ⇒ AttributeList
Returns a new instance of AttributeList.
87 88 89 |
# File 'lib/hom.rb', line 87 def initialize @index = {} end |
Instance Method Details
#set(name, value = Undefined) ⇒ Object
91 92 93 |
# File 'lib/hom.rb', line 91 def set(name, value = Undefined) @index[name.to_s] = value end |
#to_hash ⇒ Object
95 96 97 |
# File 'lib/hom.rb', line 95 def to_hash @index end |
#update(object) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/hom.rb', line 99 def update(object) case object when NilClass :pass when Hash object.each { |k, v| set(k, v) } when Array object.each { |item| update(item) } else set(object) end return self end |