Class: ScopeHunter::ScopeIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/scope_hunter/scope_index.rb

Instance Method Summary collapse

Constructor Details

#initializeScopeIndex

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