Class: Searchlight::Search
- Inherits:
-
Object
- Object
- Searchlight::Search
- Extended by:
- Adapters::ActionView::ClassMethods, Adapters::ActiveRecord, DSL
- Defined in:
- lib/searchlight/search.rb
Instance Attribute Summary collapse
- #search ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Search
constructor
A new instance of Search.
- #results ⇒ Object
Methods included from DSL
Methods included from Adapters::ActionView::ClassMethods
Methods included from Adapters::ActiveRecord
Constructor Details
#initialize(options = {}) ⇒ Search
Returns a new instance of Search.
20 21 22 |
# File 'lib/searchlight/search.rb', line 20 def initialize( = {}) .each { |key, value| public_send("#{key}=", value) } end |
Instance Attribute Details
#search ⇒ Object
24 25 26 |
# File 'lib/searchlight/search.rb', line 24 def search @search ||= self.class.search_target end |
Class Method Details
.method_added(name) ⇒ Object
15 16 17 18 |
# File 'lib/searchlight/search.rb', line 15 def self.method_added(name) @search_methods ||= Set.new search_methods << name.to_s if name.to_s.start_with?('search_') end |
.search_methods ⇒ Object
11 12 13 |
# File 'lib/searchlight/search.rb', line 11 def self.search_methods defined?(@search_methods) ? @search_methods : superclass.search_methods end |
.search_target ⇒ Object
7 8 9 |
# File 'lib/searchlight/search.rb', line 7 def self.search_target defined?(@search_target) ? @search_target : superclass.search_target end |
Instance Method Details
#results ⇒ Object
28 29 30 |
# File 'lib/searchlight/search.rb', line 28 def results @results ||= run end |