Class: Administrate::Search::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/administrate/search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#filtersObject (readonly)

Returns the value of attribute filters.



7
8
9
# File 'lib/administrate/search.rb', line 7

def filters
  @filters
end

#valid_filtersObject (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

Returns:

  • (Boolean)


9
10
11
# File 'lib/administrate/search.rb', line 9

def blank?
  terms.blank? && filters.empty?
end

#originalObject



19
20
21
# File 'lib/administrate/search.rb', line 19

def original
  @original_query
end

#termsObject



23
24
25
# File 'lib/administrate/search.rb', line 23

def terms
  @terms.join(" ")
end

#to_sObject



27
28
29
# File 'lib/administrate/search.rb', line 27

def to_s
  original
end