Class: SplitIoClient::ContainsAllMatcher

Inherits:
SetMatcher
  • Object
show all
Defined in:
lib/splitclient-rb/engine/matchers/contains_all_matcher.rb

Constant Summary collapse

MATCHER_TYPE =
'CONTAINS_ALL'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SetMatcher

#string_type?

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



7
8
9
# File 'lib/splitclient-rb/engine/matchers/contains_all_matcher.rb', line 7

def attribute
  @attribute
end

Instance Method Details

#match?(args) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
# File 'lib/splitclient-rb/engine/matchers/contains_all_matcher.rb', line 9

def match?(args)
  if @remote_set.empty?
    @logger.log_if_debug('[ContainsAllMatcher] Remote Set Empty')
    return false
  end

  matches = @remote_set.subset? local_set(args[:attributes], @attribute)
  @logger.log_if_debug("[ContainsAllMatcher] Remote Set #{@remote_set} contains #{@attribute} -> #{matches}")
  matches
end