Class: SyntaxTree::MethodAddBlock
Overview
MethodAddBlock represents a method call with a block argument.
method {}
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
- BraceBlock | DoBlock
-
the block being sent with the method call.
-
#call ⇒ Object
readonly
- Call | Command | CommandCall | FCall
-
the method call.
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
Attributes inherited from Node
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- #format(q) ⇒ Object
-
#initialize(call:, block:, location:, comments: []) ⇒ MethodAddBlock
constructor
A new instance of MethodAddBlock.
Methods inherited from Node
Constructor Details
#initialize(call:, block:, location:, comments: []) ⇒ MethodAddBlock
Returns a new instance of MethodAddBlock.
5514 5515 5516 5517 5518 5519 |
# File 'lib/syntax_tree/node.rb', line 5514 def initialize(call:, block:, location:, comments: []) @call = call @block = block @location = location @comments = comments end |
Instance Attribute Details
#block ⇒ Object (readonly)
- BraceBlock | DoBlock
-
the block being sent with the method call
5509 5510 5511 |
# File 'lib/syntax_tree/node.rb', line 5509 def block @block end |
#call ⇒ Object (readonly)
- Call | Command | CommandCall | FCall
-
the method call
5506 5507 5508 |
# File 'lib/syntax_tree/node.rb', line 5506 def call @call end |
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
5512 5513 5514 |
# File 'lib/syntax_tree/node.rb', line 5512 def comments @comments end |
Instance Method Details
#accept(visitor) ⇒ Object
5521 5522 5523 |
# File 'lib/syntax_tree/node.rb', line 5521 def accept(visitor) visitor.visit_method_add_block(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
5525 5526 5527 |
# File 'lib/syntax_tree/node.rb', line 5525 def child_nodes [call, block] end |
#deconstruct_keys(keys) ⇒ Object
5531 5532 5533 |
# File 'lib/syntax_tree/node.rb', line 5531 def deconstruct_keys(keys) { call: call, block: block, location: location, comments: comments } end |
#format(q) ⇒ Object
5535 5536 5537 5538 |
# File 'lib/syntax_tree/node.rb', line 5535 def format(q) q.format(call) q.format(block) end |