Class: LibRubyParser::Nodes::Block
- Inherits:
-
LibRubyParser::Node
- Object
- LibRubyParser::Node
- LibRubyParser::Nodes::Block
- Defined in:
- lib/lib-ruby-parser/nodes.rb
Overview
Represents a Ruby block that is passed to a method (‘proc { |foo| bar }`)
Instance Attribute Summary collapse
-
#args ⇒ Node?
readonly
A list of argument that block takes.
-
#begin_l ⇒ Loc
readonly
Location of the open brace.
-
#body ⇒ Node?
readonly
Block body,
Noneif block has no body. -
#call ⇒ Node
readonly
Method call that takes a block.
-
#end_l ⇒ Loc
readonly
Location of the closing brace.
-
#expression_l ⇒ Loc
readonly
Location of the full expression.
Instance Attribute Details
#args ⇒ Node? (readonly)
A list of argument that block takes
‘vec![ Arg(“a”), Optarg(“b”, Int(“1”)) ]` for `proc { |a, b = 1| }`
None if the block takes no arguments
369 370 371 |
# File 'lib/lib-ruby-parser/nodes.rb', line 369 def args @args end |
#begin_l ⇒ Loc (readonly)
Location of the open brace
“‘text proc { }
~
“‘
382 383 384 |
# File 'lib/lib-ruby-parser/nodes.rb', line 382 def begin_l @begin_l end |
#body ⇒ Node? (readonly)
Block body, None if block has no body.
373 374 375 |
# File 'lib/lib-ruby-parser/nodes.rb', line 373 def body @body end |
#call ⇒ Node (readonly)
Method call that takes a block
‘Send(“foo”)` in `foo {}`
361 362 363 |
# File 'lib/lib-ruby-parser/nodes.rb', line 361 def call @call end |
#end_l ⇒ Loc (readonly)
Location of the closing brace
“‘text proc { }
~
“‘
391 392 393 |
# File 'lib/lib-ruby-parser/nodes.rb', line 391 def end_l @end_l end |
#expression_l ⇒ Loc (readonly)
Location of the full expression
“‘text proc { } ~~~~~~~~ “`
400 401 402 |
# File 'lib/lib-ruby-parser/nodes.rb', line 400 def expression_l @expression_l end |