Class: Melbourne::AST::Block
- Defined in:
- lib/melbourne/ast/definitions.rb
Overview
A code block as in:
begin
end
but also as in (implicit block):
a = 1; b = 2
Instance Attribute Summary collapse
-
#array ⇒ Object
The statements inside of the block.
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(line, array) ⇒ Block
constructor
A new instance of Block.
-
#strip_arguments ⇒ Object
TODO: document!.
Methods inherited from Node
Constructor Details
#initialize(line, array) ⇒ Block
Returns a new instance of Block.
64 65 66 67 |
# File 'lib/melbourne/ast/definitions.rb', line 64 def initialize(line, array) @line = line @array = array end |
Instance Attribute Details
#array ⇒ Object
The statements inside of the block
62 63 64 |
# File 'lib/melbourne/ast/definitions.rb', line 62 def array @array end |
Instance Method Details
#strip_arguments ⇒ Object
TODO: document!
70 71 72 73 74 75 76 77 78 |
# File 'lib/melbourne/ast/definitions.rb', line 70 def strip_arguments if @array.first.kind_of? FormalArguments node = @array.shift if @array.first.kind_of? BlockArgument node.block_arg = @array.shift end return node end end |