Class: SplitIoClient::EqualToSemverMatcher
- Defined in:
- lib/splitclient-rb/engine/matchers/equal_to_semver_matcher.rb
Constant Summary collapse
- MATCHER_TYPE =
'EQUAL_TO_SEMVER'
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
Instance Method Summary collapse
-
#initialize(attribute, string_value, logger, validator) ⇒ EqualToSemverMatcher
constructor
A new instance of EqualToSemverMatcher.
- #match?(args) ⇒ Boolean
Methods inherited from Matcher
Constructor Details
#initialize(attribute, string_value, logger, validator) ⇒ EqualToSemverMatcher
Returns a new instance of EqualToSemverMatcher.
9 10 11 12 13 14 15 |
# File 'lib/splitclient-rb/engine/matchers/equal_to_semver_matcher.rb', line 9 def initialize(attribute, string_value, logger, validator) super(logger) @validator = validator @attribute = attribute @semver = SplitIoClient::Semver.build(string_value, logger) @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_semver_matcher.rb', line 7 def attribute @attribute end |
Instance Method Details
#match?(args) ⇒ Boolean
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/splitclient-rb/engine/matchers/equal_to_semver_matcher.rb', line 17 def match?(args) return false unless verify_semver_arg?(args, 'EqualsToSemverMatcher') value_to_match = SplitIoClient::Semver.build(args[:attributes][@attribute.to_sym], @logger) return false unless check_semver_value_to_match(value_to_match, MATCHER_TYPE) matches = (@semver.version == value_to_match.version) @logger.debug("[EqualsToSemverMatcher] #{value_to_match} matches -> #{matches}") matches end |