Class: LibRubyParser::Nodes::Const

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

Overview

Represents constant access (i.e. Foo::Bar)

Instance Attribute Summary collapse

Instance Attribute Details

#double_colon_lLoc? (readonly)

Location of the :: operator. None if constant is taken from the current scope.

A::B
 ~~

Returns:



798
799
800
# File 'lib/lib-ruby-parser/nodes.rb', line 798

def double_colon_l
  @double_colon_l
end

#expression_lLoc (readonly)

Location of the full expression

Foo::Bar
~~~~~~~~

Returns:



816
817
818
# File 'lib/lib-ruby-parser/nodes.rb', line 816

def expression_l
  @expression_l
end

#nameString (readonly)

Name of the constant, String("Foo") for Foo

Returns:

  • (String)


789
790
791
# File 'lib/lib-ruby-parser/nodes.rb', line 789

def name
  @name
end

#name_lLoc (readonly)

Location of the constant name

Foo::Bar
     ~~~

Returns:



807
808
809
# File 'lib/lib-ruby-parser/nodes.rb', line 807

def name_l
  @name_l
end

#scopeNode? (readonly)

Scope where the constant is taken from:

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

Returns:



785
786
787
# File 'lib/lib-ruby-parser/nodes.rb', line 785

def scope
  @scope
end