Sha256: 8e12f62aea91cdcb3daaed975badf3f5004dbd2d1d4af89daff92ca5dc51c9e6
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
module SplitIoClient # # class to implement the user defined matcher # class WhitelistMatcher < NoMethodError # variable that contains the keys of the whitelist @whitelist = [] def initialize(whitelist) unless whitelist.nil? @whitelist = whitelist end end # # evaluates if the key matches the matcher # # @param key [string] key value to be matched # # @return [boolean] evaluation of the key against the whitelist def match?(key) @whitelist.include?(key) 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 !obj.instance_of?(WhitelistMatcher) false elsif self.equal?(obj) true else false end end # # function to print string value for this matcher # # @reutrn [string] string value of this matcher def to_s 'in segment ' + @whitelist.to_s end end end
Version data entries
3 entries across 3 versions & 1 rubygems