Sha256: ee57ff9cf499882543db3a44a3cce100f43ee3a9a9bc6443c7ee7a636df047a0

Contents?: true

Size: 789 Bytes

Versions: 294

Compression:

Stored size: 789 Bytes

Contents

# frozen_string_literal: true

module SplitIoClient
  #
  # class to implement the user defined matcher
  #
  class UserDefinedSegmentMatcher < Matcher
    MATCHER_TYPE = 'IN_SEGMENT'

    def initialize(segments_repository, segment_name, logger)
      super(logger)
      @segments_repository = segments_repository
      @segment_name = segment_name
    end

    #
    # evaluates if the key matches the matcher
    #
    # @param key [string] key value to be matched
    #
    # @return [boolean] evaluation of the key against the segment
    def match?(args)
      matches = @segments_repository.in_segment?(@segment_name, args[:value] || args[:matching_key])
      @logger.log_if_debug("[InSegmentMatcher] #{@segment_name} is in segment -> #{matches}")
      matches
    end
  end
end

Version data entries

294 entries across 294 versions & 1 rubygems

Version Path
splitclient-rb-8.4.0-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.4.0 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.4.0.pre.rc1-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.4.0.pre.rc1 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.4.0.rc.1-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.4.0.rc.1 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.2.pre.rc2-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.2.pre.rc2 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.2.pre.rc1-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.2.pre.rc1 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.1-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.1 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.1.pre.rc1-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.1.pre.rc1 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.0-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.0 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.0.pre.rc3-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.0.pre.rc3 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.0.pre.rc2-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-8.3.0.pre.rc2 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb