Class: LibRubyParser::Nodes::MatchVar

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

Overview

Represents matching with assignment into a local variable (i.e. pattern => var)

Instance Attribute Summary collapse

Instance Attribute Details

#expression_lLoc (readonly)

Location of the full expression

case foo; in pattern => bar; end
                        ~~~

Note it can also be produced by a hash pattern

case foo; in { a: }; end
               ~~

Returns:



2833
2834
2835
# File 'lib/lib-ruby-parser/nodes.rb', line 2833

def expression_l
  @expression_l
end

#nameString (readonly)

Name of the variable that is assigned if matching succeeds

Returns:

  • (String)


2801
2802
2803
# File 'lib/lib-ruby-parser/nodes.rb', line 2801

def name
  @name
end

#name_lLoc (readonly)

Location of the name

case foo; in pattern => bar; end
                        ~~~

Note it can also be produced by a hash pattern

case foo; in { a: }; end
               ~

Returns:



2817
2818
2819
# File 'lib/lib-ruby-parser/nodes.rb', line 2817

def name_l
  @name_l
end