Sha256: aa5119b3821d000a48ab650cdcd30cafad35df9d43d34c3069a6c8889b3e4032

Contents?: true

Size: 416 Bytes

Versions: 2

Compression:

Stored size: 416 Bytes

Contents

module SplitIoClient
  class StartsWithMatcher
    def self.matcher_type
      'STARTS_WITH'.freeze
    end

    def initialize(attribute, prefix_list)
      @attribute = attribute
      @prefix_list = prefix_list
    end

    def match?(value, _matching_key, _bucketing_key, _evaluator)
      return false if @prefix_list.empty?

      @prefix_list.any? { |prefix| value.to_s.start_with? prefix }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
splitclient-rb-4.3.0.canary.2 lib/splitclient-rb/engine/matchers/starts_with_matcher.rb
splitclient-rb-4.3.0.canary.1 lib/splitclient-rb/engine/matchers/starts_with_matcher.rb