Class: ScopeHunter::ScopeIndex
- Inherits:
-
Object
- Object
- ScopeHunter::ScopeIndex
- Defined in:
- lib/scope_hunter/scope_index.rb
Instance Method Summary collapse
- #add(model:, name:, signature:) ⇒ Object
- #find(signature) ⇒ Object
-
#initialize ⇒ ScopeIndex
constructor
A new instance of ScopeIndex.
Constructor Details
#initialize ⇒ ScopeIndex
Returns a new instance of ScopeIndex.
7 8 9 |
# File 'lib/scope_hunter/scope_index.rb', line 7 def initialize @by_signature = {} end |
Instance Method Details
#add(model:, name:, signature:) ⇒ Object
11 12 13 |
# File 'lib/scope_hunter/scope_index.rb', line 11 def add(model:, name:, signature:) (@by_signature[signature] ||= []) << Scope.new(model:, name:, signature:) end |
#find(signature) ⇒ Object
15 16 17 |
# File 'lib/scope_hunter/scope_index.rb', line 15 def find(signature) Array(@by_signature[signature]).first end |