Class: LibRubyParser::Nodes::Procarg0

Inherits:
LibRubyParser::Node show all
Defined in:
lib/lib-ruby-parser/nodes.rb

Overview

Represents a sole block argument (e.g. |foo|)

Block that takes a single array argument automatically expands it. Adding trailing comma after block argument disables this behavior (and then the only argument is emitted as Arg).

Instance Attribute Summary collapse

Instance Attribute Details

#args::Array<Node> (readonly)

Parts of the sole block argument.

proc { |(a, b)| } also counts as a sole argument, so this list may contain:

  1. A single Arg node (for proc { |a| } case)
  2. Multiple Arg nodes (for proc { |(a, b, c)| } case)

Returns:



3353
3354
3355
# File 'lib/lib-ruby-parser/nodes.rb', line 3353

def args
  @args
end

#begin_lLoc? (readonly)

Location of the open parenthesis

proc { |(foo, bar)| }
        ~

None if there's only one argument

Returns:



3364
3365
3366
# File 'lib/lib-ruby-parser/nodes.rb', line 3364

def begin_l
  @begin_l
end

#end_lLoc? (readonly)

Location of the open parenthesis

proc { |(foo, bar)| }
                 ~

None if there's only one argument

Returns:



3375
3376
3377
# File 'lib/lib-ruby-parser/nodes.rb', line 3375

def end_l
  @end_l
end

#expression_lLoc (readonly)

Location of the full expression

proc { |(foo, bar)| }
        ~~~~~~~~~~

Returns:



3384
3385
3386
# File 'lib/lib-ruby-parser/nodes.rb', line 3384

def expression_l
  @expression_l
end