Sha256: c9db754c8c86e15d60a2e1fe4ac7211c1c86fee456a65840aee8769f929d0f37

Contents?: true

Size: 558 Bytes

Versions: 294

Compression:

Stored size: 558 Bytes

Contents

# frozen_string_literal: true

require 'set'

module SplitIoClient
  class SetMatcher
    def string_type?
      false
    end

    protected

    def initialize(attribute, remote_array, logger)
      @attribute = attribute
      @remote_set = remote_array.to_set
      @logger = logger
    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

294 entries across 294 versions & 1 rubygems

Version Path
splitclient-rb-7.3.3.pre.rc16-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc16 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc15-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc15 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc14-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc14 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc13-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc13 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc12-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc12 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc11-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc11 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc10-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc10 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc9-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc9 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc8-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc8 lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc7-java lib/splitclient-rb/engine/matchers/set_matcher.rb
splitclient-rb-7.3.3.pre.rc7 lib/splitclient-rb/engine/matchers/set_matcher.rb