Sha256: 4574cd2320c5900f567cdc8b01c073cfc965f258f97960dc662823dce07d1842

Contents?: true

Size: 527 Bytes

Versions: 28

Compression:

Stored size: 527 Bytes

Contents

# frozen_string_literal: true

require 'set'

module SplitIoClient
  class SetMatcher
    def string_type?
      false
    end

    protected

    def initialize(attribute, remote_array)
      @attribute = attribute
      @remote_set = remote_array.to_set
    end

    def local_set(data, attribute)
      data = data.fetch(attribute) { |a| data[a.to_s] || data[a.to_sym] }
      # Allow user to pass individual elements as well
      local_array = data.is_a?(Array) ? data : [data]

      local_array.to_set
    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/set_matcher.rb
splitclient-rb-6.4.1 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.1.pre.rc3-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.1.pre.rc3 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.1.pre.rc2-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.1.pre.rc2 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.1.pre.rc1-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.1.pre.rc1 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.0-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.0 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.0.pre.rc1-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.4.0.pre.rc1 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.3.0-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.3.0 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.3.0.pre.rc1-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.3.0.pre.rc1 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.2.0-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.2.0 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.2.0.pre.rc2-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-6.2.0.pre.rc2 lib/splitclient-rb/engine/matchers/set_matcher.rb