Sha256: 30f93aa7d5018b052c1cf96c76cb2c741a914d36390dbfcede32a415285dd61f

Contents?: true

Size: 1000 Bytes

Versions: 5

Compression:

Stored size: 1000 Bytes

Contents

module SplitIoClient
  #
  # class to implement the all keys matcher
  #
  class AllKeysMatcher < NoMethodError
    attr_reader :matcher_type

    def initialize
      @matcher_type = 'ALL_KEYS'
    end

    #
    # evaluates if the key matches the matcher
    #
    # @param key [string] key value to be matched
    #
    # @return [boolean] true for all instances
    def match?(_matching_key, _bucketing_key, _evaluator, _attributes)
      true
    end

    #
    # evaluates if the given object equals the matcher
    #
    # @param obj [object] object to be evaluated
    #
    # @returns [boolean] true if obj equals the matcher
    def equals?(obj)
      if obj.nil?
        false
      elsif equal?(obj)
        true
      elsif !obj.instance_of?(AllKeysMatcher)
        false
      else
        true
      end
    end

    #
    # function to print string value for this matcher
    #
    # @reutrn [string] string value of this matcher
    def to_s
      'in segment all'
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
splitclient-rb-4.3.0.canary.2 lib/splitclient-rb/engine/matchers/all_keys_matcher.rb
splitclient-rb-4.3.0.canary.1 lib/splitclient-rb/engine/matchers/all_keys_matcher.rb
splitclient-rb-4.2.2 lib/splitclient-rb/engine/matchers/all_keys_matcher.rb
splitclient-rb-4.2.1 lib/splitclient-rb/engine/matchers/all_keys_matcher.rb
splitclient-rb-4.2.0 lib/splitclient-rb/engine/matchers/all_keys_matcher.rb