Class: LibRubyParser::Nodes::Casgn
- Inherits:
-
LibRubyParser::Node
- Object
- LibRubyParser::Node
- LibRubyParser::Nodes::Casgn
- Defined in:
- lib/lib-ruby-parser/nodes.rb
Overview
Represents a constant assignment (i.e. A = 1)
Instance Attribute Summary collapse
-
#double_colon_l ⇒ Loc?
readonly
Location of the
::operator. -
#expression_l ⇒ Loc
readonly
Location of the full expression.
-
#name ⇒ String
readonly
Name of the constant,
String("A")forA = 1. -
#name_l ⇒ Loc
readonly
Location of the constant name.
-
#operator_l ⇒ Loc?
readonly
Location of the
=operator. -
#scope ⇒ Node?
readonly
Scope where the constant is defined: 1.
-
#value ⇒ Node?
readonly
Value that is assigned to a constant,
Int("1")forA = 1.
Instance Attribute Details
#double_colon_l ⇒ Loc? (readonly)
Location of the :: operator
A::B = 1
~~
::A = 1
~~
None if the constant is defined in the current scope
647 648 649 |
# File 'lib/lib-ruby-parser/nodes.rb', line 647 def double_colon_l @double_colon_l end |
#expression_l ⇒ Loc (readonly)
Location of the full expression
A = 1
~~~~~
677 678 679 |
# File 'lib/lib-ruby-parser/nodes.rb', line 677 def expression_l @expression_l end |
#name ⇒ String (readonly)
Name of the constant, String("A") for A = 1
626 627 628 |
# File 'lib/lib-ruby-parser/nodes.rb', line 626 def name @name end |
#name_l ⇒ Loc (readonly)
Location of the constant name
A::CONST = 1
~~~~~
656 657 658 |
# File 'lib/lib-ruby-parser/nodes.rb', line 656 def name_l @name_l end |
#operator_l ⇒ Loc? (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
668 669 670 |
# File 'lib/lib-ruby-parser/nodes.rb', line 668 def operator_l @operator_l end |
#scope ⇒ Node? (readonly)
Scope where the constant is defined:
Some(Const("A"))forA::B = 1Noneif it's defined in the current scope (i.e.A = 1)Some(Cbase)if it's defined in the global scope (i.e.::A = 1)
622 623 624 |
# File 'lib/lib-ruby-parser/nodes.rb', line 622 def scope @scope end |
#value ⇒ Node? (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.
633 634 635 |
# File 'lib/lib-ruby-parser/nodes.rb', line 633 def value @value end |