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(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(matcher = nil) ⇒ NegationMatcher
Returns a new instance of NegationMatcher.
10 11 12 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 10 def initialize(matcher = nil) @matcher = matcher end |
Instance Method Details
#attribute ⇒ Object
30 31 32 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 30 def attribute @matcher.attribute end |
#match?(args) ⇒ boolean
evaluates if the key matches the negation of the matcher
20 21 22 23 24 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 20 def match?(args) matches = !@matcher.match?(args) SplitLogger.log_if_debug("[NegationMatcherMatcher] Matcher #{@matcher} Arguments #{args} -> #{matches}") matches end |
#respond_to?(method) ⇒ Boolean
26 27 28 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 26 def respond_to?(method) @matcher.respond_to? method end |
#string_type? ⇒ Boolean
34 35 36 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 34 def string_type? @matcher.string_type? end |
#to_s ⇒ string
function to print string value for this matcher
42 43 44 |
# File 'lib/splitclient-rb/engine/matchers/negation_matcher.rb', line 42 def to_s "not #{@matcher}" end |