Class: TreeStruct::Attributes

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

Instance Method Summary collapse

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