Class: TreeStruct::Attributes
- Inherits:
-
Object
- Object
- TreeStruct::Attributes
- Defined in:
- lib/tree_struct/attributes.rb
Instance Method Summary collapse
- #add(attribute) ⇒ Object
-
#initialize(items = []) ⇒ Attributes
constructor
A new instance of Attributes.
- #map(*args, &block) ⇒ Object
Constructor Details
#initialize(items = []) ⇒ Attributes
Returns a new instance of Attributes.
3 4 5 |
# File 'lib/tree_struct/attributes.rb', line 3 def initialize(items = []) @items = items end |
Instance Method Details
#add(attribute) ⇒ Object
7 8 9 |
# File 'lib/tree_struct/attributes.rb', line 7 def add(attribute) self.class.new(@items + [attribute]) end |
#map(*args, &block) ⇒ Object
11 12 13 |
# File 'lib/tree_struct/attributes.rb', line 11 def map(*args, &block) @items.map(*args, &block) end |