Class: LibRubyParser::Nodes::Casgn

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

Overview

Represents a constant assignment (i.e. A = 1)

Instance Attribute Summary collapse

Instance Attribute Details

#double_colon_lLoc? (readonly)

Location of the :: operator

A::B = 1
 ~~

::A = 1
~~

None if the constant is defined in the current scope

Returns:



647
648
649
# File 'lib/lib-ruby-parser/nodes.rb', line 647

def double_colon_l
  @double_colon_l
end

#expression_lLoc (readonly)

Location of the full expression

A = 1
~~~~~

Returns:



677
678
679
# File 'lib/lib-ruby-parser/nodes.rb', line 677

def expression_l
  @expression_l
end

#nameString (readonly)

Name of the constant, String("A") for A = 1

Returns:

  • (String)


626
627
628
# File 'lib/lib-ruby-parser/nodes.rb', line 626

def name
  @name
end

#name_lLoc (readonly)

Location of the constant name

A::CONST = 1
   ~~~~~

Returns:



656
657
658
# File 'lib/lib-ruby-parser/nodes.rb', line 656

def name_l
  @name_l
end

#operator_lLoc? (readonly)

Location of the = operator

A = 1
  ~

None if constant assignment is a part of the multi-assignment. In such case = belongs to a Masgn node

Returns:



668
669
670
# File 'lib/lib-ruby-parser/nodes.rb', line 668

def operator_l
  @operator_l
end

#scopeNode? (readonly)

Scope where the constant is defined:

  1. Some(Const("A")) for A::B = 1
  2. None if it's defined in the current scope (i.e. A = 1)
  3. Some(Cbase) if it's defined in the global scope (i.e. ::A = 1)

Returns:



622
623
624
# File 'lib/lib-ruby-parser/nodes.rb', line 622

def scope
  @scope
end

#valueNode? (readonly)

Value that is assigned to a constant, Int("1") for A = 1.

Note: None if constant assignment is a part of the multi-assignment. In such case value belongs to Masgn node of the multi-assignment.

Returns:



633
634
635
# File 'lib/lib-ruby-parser/nodes.rb', line 633

def value
  @value
end