Class: SplitIoClient::NegationMatcher
- Defined in:
- lib/splitclient-rb/engine/matchers/negation_matcher.rb
Overview
class to implement the negation of a matcher
Constant Summary collapse
- MATCHER_TYPE =
'NEGATION_MATCHER'
Instance Method Summary collapse
- #attribute ⇒ Object
-
#initialize(logger, matcher = nil) ⇒ NegationMatcher
constructor
A new instance of NegationMatcher.
-
#match?(args) ⇒ boolean
evaluates if the key matches the negation of the matcher.
- #respond_to?(method) ⇒ Boolean
- #string_type? ⇒ Boolean
-
#to_s ⇒ string
function to print string value for this matcher.
Methods inherited from Matcher
Constructor Details
#initialize(logger, matcher = nil) ⇒ NegationMatcher
Returns a new instance of NegationMatcher.
10 11 12 13 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 10 def initialize(logger, matcher = nil) super(logger) @matcher = matcher end |
Instance Method Details
#attribute ⇒ Object
31 32 33 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 31 def attribute @matcher.attribute end |
#match?(args) ⇒ boolean
evaluates if the key matches the negation of the matcher
21 22 23 24 25 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 21 def match?(args) matches = !@matcher.match?(args) @logger.log_if_debug("[NegationMatcherMatcher] Matcher #{@matcher} Arguments #{args} -> #{matches}") matches end |
#respond_to?(method) ⇒ Boolean
27 28 29 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 27 def respond_to?(method) @matcher.respond_to? method end |
#string_type? ⇒ Boolean
35 36 37 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 35 def string_type? @matcher.string_type? end |
#to_s ⇒ string
function to print string value for this matcher
43 44 45 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 43 def to_s "not #{@matcher}" end |