Class: Administrate::Search::Query
- Inherits:
-
Object
- Object
- Administrate::Search::Query
- Defined in:
- lib/administrate/search.rb
Instance Attribute Summary collapse
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
-
#valid_filters ⇒ Object
readonly
Returns the value of attribute valid_filters.
Instance Method Summary collapse
- #blank? ⇒ Boolean
-
#initialize(original_query, valid_filters = nil) ⇒ Query
constructor
A new instance of Query.
- #original ⇒ Object
- #terms ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(original_query, valid_filters = nil) ⇒ Query
Returns a new instance of Query.
13 14 15 16 17 |
# File 'lib/administrate/search.rb', line 13 def initialize(original_query, valid_filters = nil) @original_query = original_query @valid_filters = valid_filters @filters, @terms = parse_query(original_query) end |
Instance Attribute Details
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
7 8 9 |
# File 'lib/administrate/search.rb', line 7 def filters @filters end |
#valid_filters ⇒ Object (readonly)
Returns the value of attribute valid_filters.
7 8 9 |
# File 'lib/administrate/search.rb', line 7 def valid_filters @valid_filters end |
Instance Method Details
#blank? ⇒ Boolean
9 10 11 |
# File 'lib/administrate/search.rb', line 9 def blank? terms.blank? && filters.empty? end |
#original ⇒ Object
19 20 21 |
# File 'lib/administrate/search.rb', line 19 def original @original_query end |
#terms ⇒ Object
23 24 25 |
# File 'lib/administrate/search.rb', line 23 def terms @terms.join(" ") end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/administrate/search.rb', line 27 def to_s original end |