Module: PgSearch::Model
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pg_search/model.rb', line 32 def method_missing(method, *, **) case method when :pg_search_rank raise PgSearchRankNotSelected unless respond_to?(:pg_search_rank) read_attribute(:pg_search_rank).to_f when :pg_search_highlight raise PgSearchHighlightNotSelected unless respond_to?(:pg_search_highlight) read_attribute(:pg_search_highlight) else super end end |
Instance Method Details
#respond_to_missing?(method) ⇒ Boolean
47 48 49 50 51 52 53 |
# File 'lib/pg_search/model.rb', line 47 def respond_to_missing?(method, *, **) if method.in?(%i[pg_search_rank pg_search_highlight]) attributes.key?(method) else super end end |