Class: LibRubyParser::Nodes::Block

Inherits:
LibRubyParser::Node show all
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

Instance Attribute Details

#argsNode? (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

Returns:



369
370
371
# File 'lib/lib-ruby-parser/nodes.rb', line 369

def args
  @args
end

#begin_lLoc (readonly)

Location of the open brace

proc { }
     ~

Returns:



382
383
384
# File 'lib/lib-ruby-parser/nodes.rb', line 382

def begin_l
  @begin_l
end

#bodyNode? (readonly)

Block body, None if block has no body.

Returns:



373
374
375
# File 'lib/lib-ruby-parser/nodes.rb', line 373

def body
  @body
end

#callNode (readonly)

Method call that takes a block

Send("foo") in foo {}

Returns:



361
362
363
# File 'lib/lib-ruby-parser/nodes.rb', line 361

def call
  @call
end

#end_lLoc (readonly)

Location of the closing brace

proc { }
       ~

Returns:



391
392
393
# File 'lib/lib-ruby-parser/nodes.rb', line 391

def end_l
  @end_l
end

#expression_lLoc (readonly)

Location of the full expression

proc { }
~~~~~~~~

Returns:



400
401
402
# File 'lib/lib-ruby-parser/nodes.rb', line 400

def expression_l
  @expression_l
end