Sha256: 18398b35bf766be9e6ba510909af3434976aac23866be6fef960378d091c6eee

Contents?: true

Size: 563 Bytes

Versions: 62

Compression:

Stored size: 563 Bytes

Contents

module SplitIoClient
  class EndsWithMatcher
    MATCHER_TYPE = 'ENDS_WITH'.freeze

    attr_reader :attribute

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

    def match?(args)
      value = args[:value] || args[:attributes].fetch(@attribute) do |a|
        args[:attributes][a.to_s] || args[:attributes][a.to_sym]
      end

      return false if @suffix_list.empty?

      @suffix_list.any? { |suffix| value.to_s.end_with? suffix }
    end

    def string_type?
      true
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
splitclient-rb-6.0.1-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-6.0.1 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-6.0.1.pre.rc2-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-6.0.1.pre.rc2 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-6.0.1.pre.rc1-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-6.0.1.pre.rc1 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-6.0.0-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-6.0.0 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.3.pre.rc4-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.3.pre.rc4 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.3.pre.rc3-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.3.pre.rc3 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.3.pre.rc2-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.3.pre.rc2 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.4.pre.rc1-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.4.pre.rc1 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.3.pre.rc1-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.3.pre.rc1 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.2-java lib/splitclient-rb/engine/matchers/ends_with_matcher.rb
splitclient-rb-5.1.2 lib/splitclient-rb/engine/matchers/ends_with_matcher.rb