Module: Chewy::Search::ClassMethods
- Defined in:
- lib/chewy/search.rb
Instance Method Summary collapse
-
#all ⇒ Chewy::Search::Request
This is the entry point for the request composition, however, most of the Request methods are delegated directly as well.
-
#method_missing(name, *args, &block) ⇒ Object
Delegates methods from the request class to the index or type class.
- #respond_to_missing?(name, _) ⇒ Boolean
-
#search_string(query, options = {}) ⇒ Hash
A simple way to execute search string query.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
Delegates methods from the request class to the index or type class
67 68 69 70 71 72 73 |
# File 'lib/chewy/search.rb', line 67 def method_missing(name, *args, &block) if search_class::DELEGATED_METHODS.include?(name) all.send(name, *args, &block) else super end end |
Instance Method Details
#all ⇒ Chewy::Search::Request
This is the entry point for the request composition, however, most of the Request methods are delegated directly as well.
This method also provides an ability to use names scopes.
49 50 51 |
# File 'lib/chewy/search.rb', line 49 def all search_class.scopes.last || search_class.new(self) end |
#respond_to_missing?(name, _) ⇒ Boolean
75 76 77 |
# File 'lib/chewy/search.rb', line 75 def respond_to_missing?(name, _) search_class::DELEGATED_METHODS.include?(name) || super end |