Class: Twostroke::AST::Array
Instance Attribute Summary collapse
-
#items ⇒ Object
Returns the value of attribute items.
Instance Method Summary collapse
- #collapse ⇒ Object
-
#initialize(*args) ⇒ Array
constructor
A new instance of Array.
- #walk(&bk) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Array
Returns a new instance of Array.
5 6 7 8 |
# File 'lib/twostroke/ast/array.rb', line 5 def initialize(*args) @items = [] super *args end |
Instance Attribute Details
#items ⇒ Object
Returns the value of attribute items.
3 4 5 |
# File 'lib/twostroke/ast/array.rb', line 3 def items @items end |
Instance Method Details
#collapse ⇒ Object
10 11 12 |
# File 'lib/twostroke/ast/array.rb', line 10 def collapse self.class.new items: items.map(&:collapse) end |
#walk(&bk) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/twostroke/ast/array.rb', line 14 def walk(&bk) if yield self items.each do |item| item.walk &bk end end end |