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, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from QueryStringSearch::AbstractMatcher

all_reserved_words, descendants, #initialize, matchers

Constructor Details

This class inherits a constructor from QueryStringSearch::AbstractMatcher

Class Method Details

.build_me?(_, search_param) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.build_me?(_, search_param)
  reserved_words.any? { |r| r.match(search_param) }
end

.reserved_wordsObject



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

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

Instance Method Details

#match?(target) ⇒ Boolean

Returns:

  • (Boolean)


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

def match?(target)
  match_with_contingency { !target.public_send(attribute) }
end