Class: SplitIoClient::PrerequisitesMatcher
- Inherits:
-
Object
- Object
- SplitIoClient::PrerequisitesMatcher
- Defined in:
- lib/splitclient-rb/engine/matchers/prerequisites_matcher.rb
Instance Method Summary collapse
-
#initialize(prerequisites, logger) ⇒ PrerequisitesMatcher
constructor
A new instance of PrerequisitesMatcher.
- #match?(args) ⇒ Boolean
- #string_type? ⇒ Boolean
Constructor Details
#initialize(prerequisites, logger) ⇒ PrerequisitesMatcher
Returns a new instance of PrerequisitesMatcher.
5 6 7 8 |
# File 'lib/splitclient-rb/engine/matchers/prerequisites_matcher.rb', line 5 def initialize(prerequisites, logger) @prerequisites = prerequisites @logger = logger end |
Instance Method Details
#match?(args) ⇒ Boolean
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/splitclient-rb/engine/matchers/prerequisites_matcher.rb', line 10 def match?(args) keys = { matching_key: args[:matching_key], bucketing_key: args[:bucketing_key] } match = true @prerequisites.each do |prerequisite| evaluate = args[:evaluator].evaluate_feature_flag(keys, prerequisite[:n], args[:attributes]) next if prerequisite[:ts].include?(evaluate[:treatment]) @logger.log_if_debug("[PrerequisitesMatcher] feature flag #{prerequisite[:n]} evaluated to #{evaluate[:treatment]} \ that does not exist in prerequisited treatments.") match = false break end match end |
#string_type? ⇒ Boolean
27 28 29 |
# File 'lib/splitclient-rb/engine/matchers/prerequisites_matcher.rb', line 27 def string_type? false end |