Class: Chanko::Unit::ScopeFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/chanko/unit/scope_finder.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier) ⇒ ScopeFinder

Returns a new instance of ScopeFinder.



8
9
10
# File 'lib/chanko/unit/scope_finder.rb', line 8

def initialize(identifier)
  @identifier = identifier
end

Class Method Details

.find(*args) ⇒ Object



4
5
6
# File 'lib/chanko/unit/scope_finder.rb', line 4

def self.find(*args)
  new(*args).find
end

Instance Method Details

#findObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/chanko/unit/scope_finder.rb', line 12

def find
  case
  when class?
    @identifier
  when label
    label
  else
    @identifier.to_s.constantize
  end
rescue NameError
end