Class: MatchMultipleAttributeValues

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

Instance Attribute Summary

Attributes inherited from QueryStringSearch::AbstractMatcher

#attribute, #desired_value

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)


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

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

.reserved_wordsObject



12
13
14
15
16
# File 'lib/query_string_search/matchers/match_multiple_attribute_values.rb', line 12

def self.reserved_words
  [
    /^\w+\|\w+/
  ]
end

Instance Method Details

#desired_value=(x) ⇒ Object



18
19
20
# File 'lib/query_string_search/matchers/match_multiple_attribute_values.rb', line 18

def desired_value=(x)
  super(x.split("|"))
end

#match?(data) ⇒ Boolean

Returns:

  • (Boolean)


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

def match?(data)
  match_with_contingency do
    comparison.compare(actual_value(data))
  end
end

#operatorObject



8
9
10
# File 'lib/query_string_search/matchers/match_multiple_attribute_values.rb', line 8

def operator
  :&
end