Class: Mutant::Scope Private

Inherits:
Object
  • Object
show all
Includes:
Unparser::Adamantium
Defined in:
lib/mutant/scope.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class or Module bound to an exact expression

Constant Summary collapse

NAMESPACE_DELIMITER =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'::'

Instance Method Summary collapse

Instance Method Details

#match_expressionsEnumerable<Expression>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Match expressions for scope

Returns:



31
32
33
34
35
36
37
# File 'lib/mutant/scope.rb', line 31

def match_expressions
  name_nesting.each_index.reverse_each.map do |index|
    Expression::Namespace::Recursive.new(
      scope_name: name_nesting.take(index.succ).join(NAMESPACE_DELIMITER)
    )
  end
end

#nestingEnumerable<Class,Module>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Nesting of scope

Returns:

  • (Enumerable<Class,Module>)


13
14
15
16
17
18
# File 'lib/mutant/scope.rb', line 13

def nesting
  const = Object
  name_nesting.map do |name|
    const = const.const_get(name)
  end
end

#unqualified_nameString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Unqualified name of scope

Returns:

  • (String)


24
25
26
# File 'lib/mutant/scope.rb', line 24

def unqualified_name
  name_nesting.last
end