Class: MatchNoAttribute

Inherits:
QueryStringSearch::AbstractMatcher show all
Defined in:
lib/query_string_search/matchers/match_no_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)


16
17
18
# File 'lib/query_string_search/matchers/match_no_attribute.rb', line 16

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

.reserved_wordsObject



9
10
11
12
13
14
# File 'lib/query_string_search/matchers/match_no_attribute.rb', line 9

def self.reserved_words
  [
    /^false$/,
    /^none$/
  ]
end

Instance Method Details

#match?(data) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
5
6
7
# File 'lib/query_string_search/matchers/match_no_attribute.rb', line 2

def match?(data)
  match_with_contingency do
    actual_value(data) == false ||
      Array(actual_value(data)).empty?
  end
end