Class: Nyanko::Unit::ScopeFinder
- Inherits:
-
Object
- Object
- Nyanko::Unit::ScopeFinder
- Defined in:
- lib/nyanko/unit/scope_finder.rb
Constant Summary collapse
- LABEL_SCOPE_MAP =
{ :controller => ActionController::Base, :model => ActiveRecord::Base, :view => ActionView::Base, }
Class Method Summary collapse
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(identifier) ⇒ ScopeFinder
constructor
A new instance of ScopeFinder.
Constructor Details
#initialize(identifier) ⇒ ScopeFinder
Returns a new instance of ScopeFinder.
14 15 16 |
# File 'lib/nyanko/unit/scope_finder.rb', line 14 def initialize(identifier) @identifier = identifier end |
Class Method Details
.find(*args) ⇒ Object
10 11 12 |
# File 'lib/nyanko/unit/scope_finder.rb', line 10 def self.find(*args) new(*args).find end |
Instance Method Details
#find ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/nyanko/unit/scope_finder.rb', line 18 def find case when class? @identifier when label label else @identifier.to_s.constantize end rescue NameError end |