class Orbacle::ConstRef

Attributes

const_name[R]
is_absolute[R]
nesting[R]

Public Class Methods

from_ast(ast, nesting) click to toggle source
# File lib/orbacle/const_ref.rb, line 5
def self.from_ast(ast, nesting)
  full_name = AstUtils.const_to_string(ast)
  from_full_name(full_name, nesting)
end
from_full_name(full_name, nesting) click to toggle source
# File lib/orbacle/const_ref.rb, line 10
def self.from_full_name(full_name, nesting)
  if full_name.start_with?("::")
    name = full_name[2..-1]
    new(ConstName.from_string(name), true, nesting)
  else
    new(ConstName.from_string(full_name), false, nesting)
  end
end
new(const_name, is_absolute, nesting) click to toggle source
# File lib/orbacle/const_ref.rb, line 19
def initialize(const_name, is_absolute, nesting)
  @const_name = const_name
  @is_absolute = is_absolute
  @nesting = nesting
end

Public Instance Methods

==(other) click to toggle source
# File lib/orbacle/const_ref.rb, line 39
def ==(other)
  const_name == other.const_name &&
    is_absolute == other.is_absolute &&
    nesting == other.nesting
end
absolute?() click to toggle source
# File lib/orbacle/const_ref.rb, line 27
def absolute?
  @is_absolute
end
name() click to toggle source
# File lib/orbacle/const_ref.rb, line 35
def name
  const_name.name
end
relative_name() click to toggle source
# File lib/orbacle/const_ref.rb, line 31
def relative_name
  const_name.to_string
end