Class: QueryStringSearch::AbstractMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/query_string_search/abstract_matcher.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute = nil, value = nil) ⇒ AbstractMatcher

Returns a new instance of AbstractMatcher.



17
18
19
20
# File 'lib/query_string_search/abstract_matcher.rb', line 17

def initialize(attribute = nil, value = nil)
  self.attribute = attribute
  self.value = value
end

Instance Attribute Details

#attributeObject

Returns the value of attribute attribute.



3
4
5
# File 'lib/query_string_search/abstract_matcher.rb', line 3

def attribute
  @attribute
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/query_string_search/abstract_matcher.rb', line 3

def value
  @value
end

Class Method Details

.all_reserved_wordsObject



13
14
15
# File 'lib/query_string_search/abstract_matcher.rb', line 13

def self.all_reserved_words
  descendants.each_with_object([]) { |d, ret| ret << d.reserved_words }.flatten
end

.build_me?(_, _) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/query_string_search/abstract_matcher.rb', line 30

def self.build_me?(_, _)
  true
end

.descendantsObject



9
10
11
# File 'lib/query_string_search/abstract_matcher.rb', line 9

def self.descendants
  ObjectSpace.each_object(Class).select { |klass| klass < AbstractMatcher }
end

.matchersObject



5
6
7
# File 'lib/query_string_search/abstract_matcher.rb', line 5

def self.matchers
  descendants.push(self)
end

.reserved_wordsObject



26
27
28
# File 'lib/query_string_search/abstract_matcher.rb', line 26

def self.reserved_words
  []
end

Instance Method Details

#match?(_) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/query_string_search/abstract_matcher.rb', line 22

def match?(_)
  false
end