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-7.3.3.pre.rc16-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc16 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc15-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc15 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc14-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc14 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc13-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc13 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc12-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc12 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc11-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc11 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc10-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc10 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc9-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc9 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc8-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc8 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc7-java lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb
splitclient-rb-7.3.3.pre.rc7 lib/splitclient-rb/engine/matchers/user_defined_segment_matcher.rb