Class: Gem::MultiPathSearcher

Inherits:
Object
  • Object
show all
Defined in:
lib/generators/templates/application/common/merb_thor/common.rb

Instance Method Summary collapse

Constructor Details

#initializeMultiPathSearcher

Returns a new instance of MultiPathSearcher.



33
34
35
36
# File 'lib/generators/templates/application/common/merb_thor/common.rb', line 33

def initialize
  @main_searcher = ArbitrarySearcher.new(MAIN_INDEX)
  @fallback_searcher = ArbitrarySearcher.new(FALLBACK_INDEX)
end

Instance Method Details

#find(path) ⇒ Object



38
39
40
41
42
# File 'lib/generators/templates/application/common/merb_thor/common.rb', line 38

def find(path)
  try = @main_searcher.find(path)
  return try if try
  @fallback_searcher.find(path)
end

#find_all(path) ⇒ Object



44
45
46
47
48
# File 'lib/generators/templates/application/common/merb_thor/common.rb', line 44

def find_all(path)
  try = @main_searcher.find_all(path)
  return try unless try.empty?
  @fallback_searcher.find_all(path)
end