Module: HasSearcher
- Defined in:
- lib/has_searcher.rb,
lib/has_searcher/engine.rb,
lib/has_searcher/version.rb,
app/helpers/has_searcher/application_helper.rb,
app/controllers/has_searcher/application_controller.rb
Defined Under Namespace
Modules: ApplicationHelper
Classes: ApplicationController, Engine
Constant Summary
collapse
- VERSION =
"0.0.97"
- @@searchers =
{}
Class Method Summary
collapse
Class Method Details
.cacheable_now ⇒ Object
15
16
17
|
# File 'lib/has_searcher.rb', line 15
def self.cacheable_now
1.minute.since.change(:sec => 0)
end
|
.create_searcher(name, &block) ⇒ Object
5
6
7
|
# File 'lib/has_searcher.rb', line 5
def self.create_searcher(name, &block)
@@searchers[name] = block
end
|
.searcher(name, params = {}) ⇒ Object
9
10
11
12
13
|
# File 'lib/has_searcher.rb', line 9
def self.searcher(name, params={})
(Searcher.new &@@searchers[name]).tap do |searcher|
searcher.search_object.attributes = params
end
end
|