Sha256: b8f6db06751e6f804caa0466315e1276e147c483f44f297ce7ea02ec0ea6806a

Contents?: true

Size: 760 Bytes

Versions: 28

Compression:

Stored size: 760 Bytes

Contents

# frozen_string_literal: true

module SplitIoClient
  class DependencyMatcher
    MATCHER_TYPE = 'IN_SPLIT_TREATMENT'

    def initialize(split, treatments)
      @split = split
      @treatments = treatments
    end

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

    def string_type?
      false
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
splitclient-rb-6.4.1-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.1 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.1.pre.rc3-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.1.pre.rc3 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.1.pre.rc2-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.1.pre.rc2 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.1.pre.rc1-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.1.pre.rc1 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.0-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.0 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.0.pre.rc1-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.4.0.pre.rc1 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.3.0-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.3.0 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.3.0.pre.rc1-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.3.0.pre.rc1 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.2.0-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.2.0 lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.2.0.pre.rc2-java lib/splitclient-rb/engine/matchers/dependency_matcher.rb
splitclient-rb-6.2.0.pre.rc2 lib/splitclient-rb/engine/matchers/dependency_matcher.rb