Class: Searchlight::Search
- Inherits:
-
Object
- Object
- Searchlight::Search
- Extended by:
- Adapters::ActionView::ClassMethods, Adapters::ActiveRecord, Adapters::Mongoid, DSL
- Defined in:
- lib/searchlight/search.rb
Defined Under Namespace
Classes: UndefinedOption
Instance Attribute Summary collapse
- #search ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Search
constructor
A new instance of Search.
- #options ⇒ Object
- #results ⇒ Object
Methods included from DSL
Methods included from Adapters::Mongoid
Methods included from Adapters::ActionView::ClassMethods
Methods included from Adapters::ActiveRecord
Constructor Details
#initialize(options = {}) ⇒ Search
Returns a new instance of Search.
11 12 13 |
# File 'lib/searchlight/search.rb', line 11 def initialize( = {}) filter_and_mass_assign() end |
Instance Attribute Details
#search ⇒ Object
15 16 17 |
# File 'lib/searchlight/search.rb', line 15 def search @search ||= self.class.search_target end |
Class Method Details
.search_target ⇒ Object
5 6 7 8 9 |
# File 'lib/searchlight/search.rb', line 5 def self.search_target return @search_target if defined?(@search_target) return superclass.search_target if superclass.respond_to?(:search_target) && superclass != Searchlight::Search guess_search_class! end |
Instance Method Details
#options ⇒ Object
23 24 25 26 27 28 |
# File 'lib/searchlight/search.rb', line 23 def search_attributes.reduce({}) { |hash, option_name| option_val = send(option_name) hash.tap { |hash| hash[option_name.to_sym] = option_val unless is_blank?(option_val) } } end |
#results ⇒ Object
19 20 21 |
# File 'lib/searchlight/search.rb', line 19 def results @results ||= run end |