Class: Renalware::Letters::Descriptions::SearchQuery
- Inherits:
-
Object
- Object
- Renalware::Letters::Descriptions::SearchQuery
- Defined in:
- app/models/renalware/letters/descriptions/search_query.rb
Instance Attribute Summary collapse
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#per_page ⇒ Object
readonly
Returns the value of attribute per_page.
-
#term ⇒ Object
readonly
Returns the value of attribute term.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(term) ⇒ SearchQuery
constructor
A new instance of SearchQuery.
- #search ⇒ Object
Constructor Details
#initialize(term) ⇒ SearchQuery
Returns a new instance of SearchQuery.
9 10 11 12 |
# File 'app/models/renalware/letters/descriptions/search_query.rb', line 9 def initialize(term) @search_params = { text_cont: term } @search_params.reverse_merge!(s: "text asc") end |
Instance Attribute Details
#page ⇒ Object (readonly)
Returns the value of attribute page.
7 8 9 |
# File 'app/models/renalware/letters/descriptions/search_query.rb', line 7 def page @page end |
#per_page ⇒ Object (readonly)
Returns the value of attribute per_page.
7 8 9 |
# File 'app/models/renalware/letters/descriptions/search_query.rb', line 7 def per_page @per_page end |
#term ⇒ Object (readonly)
Returns the value of attribute term.
7 8 9 |
# File 'app/models/renalware/letters/descriptions/search_query.rb', line 7 def term @term end |
Instance Method Details
#call ⇒ Object
14 15 16 |
# File 'app/models/renalware/letters/descriptions/search_query.rb', line 14 def call search.result end |
#search ⇒ Object
18 19 20 |
# File 'app/models/renalware/letters/descriptions/search_query.rb', line 18 def search @search ||= Description.search(@search_params) end |