Class: MatchAttribute

Inherits:
QueryStringSearch::AbstractMatcher show all
Defined in:
lib/query_string_search/matchers/match_attribute.rb

Instance Attribute Summary

Attributes inherited from QueryStringSearch::AbstractMatcher

#attribute, #desired_value, #operator

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from QueryStringSearch::AbstractMatcher

all_reserved_words, #comparison, descendants, matchers

Class Method Details

.build_me?(search_option) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.build_me?(search_option)
  reserved_words.any? { |r| r.match(search_option.desired_value) }
end

.reserved_wordsObject



6
7
8
9
10
11
# File 'lib/query_string_search/matchers/match_attribute.rb', line 6

def self.reserved_words
  [
    /^true$/,
    /^all$/
  ]
end

Instance Method Details

#match?(data) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/query_string_search/matchers/match_attribute.rb', line 2

def match?(data)
  match_with_contingency { actual_value(data) }
end