Class: MatchAttributeValue

Inherits:
QueryStringSearch::AbstractMatcher show all
Defined in:
lib/query_string_search/matchers/match_attribute_value.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, reserved_words

Constructor Details

This class inherits a constructor from QueryStringSearch::AbstractMatcher

Class Method Details

.build_me?(search_type, search_param) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/query_string_search/matchers/match_attribute_value.rb', line 8

def self.build_me?(search_type, search_param)
  search_param &&
    search_type &&
    all_reserved_words.none? { |r| r.match(search_param) }
end

Instance Method Details

#match?(target) ⇒ Boolean

Returns:

  • (Boolean)


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

def match?(target)
  match_with_contingency do
    target.public_send(attribute).to_s.upcase == value.to_s.upcase
  end
end