Exception: SplitIoClient::NegationMatcher
- Inherits:
-
NoMethodError
- Object
- NoMethodError
- SplitIoClient::NegationMatcher
- Defined in:
- lib/engine/matchers/negation_matcher.rb
Overview
class to implement the negation of a matcher
Instance Method Summary collapse
-
#equals?(obj) ⇒ Boolean
evaluates if the given object equals the matcher.
-
#initialize(matcher) ⇒ NegationMatcher
constructor
A new instance of NegationMatcher.
-
#match?(key, attributes) ⇒ boolean
evaluates if the key matches the negation of the matcher.
-
#to_s ⇒ Object
function to print string value for this matcher.
Constructor Details
#initialize(matcher) ⇒ NegationMatcher
Returns a new instance of NegationMatcher.
10 11 12 13 14 |
# File 'lib/engine/matchers/negation_matcher.rb', line 10 def initialize(matcher) unless matcher.nil? @matcher = matcher end end |
Instance Method Details
#equals?(obj) ⇒ Boolean
evaluates if the given object equals the matcher
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/engine/matchers/negation_matcher.rb', line 32 def equals?(obj) if obj.nil? false elsif !obj.instance_of?(NegationMatcher) false elsif self.equal?(obj) true else false end end |
#match?(key, attributes) ⇒ boolean
evaluates if the key matches the negation of the matcher
22 23 24 |
# File 'lib/engine/matchers/negation_matcher.rb', line 22 def match?(key, attributes) !@matcher.match?(key, attributes) end |
#to_s ⇒ Object
function to print string value for this matcher
48 49 50 |
# File 'lib/engine/matchers/negation_matcher.rb', line 48 def to_s 'not ' + @matcher.to_s end |