Class: SplitIoClient::EqualToBooleanMatcher
- Inherits:
-
Object
- Object
- SplitIoClient::EqualToBooleanMatcher
- Defined in:
- lib/splitclient-rb/engine/matchers/equal_to_boolean_matcher.rb
Constant Summary collapse
- MATCHER_TYPE =
'EQUAL_TO_BOOLEAN'
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
Instance Method Summary collapse
-
#initialize(attribute, boolean, logger) ⇒ EqualToBooleanMatcher
constructor
A new instance of EqualToBooleanMatcher.
- #match?(args) ⇒ Boolean
- #string_type? ⇒ Boolean
Constructor Details
#initialize(attribute, boolean, logger) ⇒ EqualToBooleanMatcher
Returns a new instance of EqualToBooleanMatcher.
9 10 11 12 13 |
# File 'lib/splitclient-rb/engine/matchers/equal_to_boolean_matcher.rb', line 9 def initialize(attribute, boolean, logger) @attribute = attribute @boolean = boolean @logger = logger end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
7 8 9 |
# File 'lib/splitclient-rb/engine/matchers/equal_to_boolean_matcher.rb', line 7 def attribute @attribute end |
Instance Method Details
#match?(args) ⇒ Boolean
15 16 17 18 19 20 21 22 23 |
# File 'lib/splitclient-rb/engine/matchers/equal_to_boolean_matcher.rb', line 15 def match?(args) value = get_value(args) value = false if value.to_s.casecmp('false').zero? value = true if value.to_s.casecmp('true').zero? matches = value == @boolean @logger.log_if_debug("[EqualToBooleanMatcher] #{value} equals to #{@boolean} -> #{matches}") matches end |
#string_type? ⇒ Boolean
25 26 27 |
# File 'lib/splitclient-rb/engine/matchers/equal_to_boolean_matcher.rb', line 25 def string_type? false end |