Sha256: 2ca98d633953ee6a66956af2e7b9e3c0bac4e79fd6a92d6ce7e86f60c239f236

Contents?: true

Size: 836 Bytes

Versions: 12

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

module SplitIoClient
  class DependencyMatcher
    MATCHER_TYPE = 'IN_SPLIT_TREATMENT'

    def initialize(feature_flag, treatments, logger)
      @feature_flag = feature_flag
      @treatments = treatments
      @logger = logger
    end

    def match?(args)
      keys = { matching_key: args[:matching_key], bucketing_key: args[:bucketing_key] }
      evaluate = args[:evaluator].call(keys, @feature_flag, args[:attributes])
      matches = @treatments.include?(evaluate[:treatment])
      @logger.log_if_debug("[dependencyMatcher] Parent feature flag #{@feature_flag} evaluated to #{evaluate[:treatment]} \
        with label #{evaluate[:label]}. #{@feature_flag} evaluated treatment is part of [#{@treatments}] ? #{matches}.")
      matches
    end

    def string_type?
      false
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
splitclient-rb-8.2.0-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.2.0 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.3.pre.rc4-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.3.pre.rc4 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.3.pre.rc3-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.3.pre.rc3 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.3.pre.rc2-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.3.pre.rc2 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.3.pre.rc1-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.3.pre.rc1 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.2-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-8.1.2 lib/splitclient-rb/engine/matchers/dependency_matcher.rb