Class: Hackle::ValueOperatorMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/hackle/internal/evaluation/match/value/value_operator_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(value_matcher_factory:, operator_matcher_factory:) ⇒ ValueOperatorMatcher

Returns a new instance of ValueOperatorMatcher.

Parameters:



9
10
11
12
13
14
# File 'lib/hackle/internal/evaluation/match/value/value_operator_matcher.rb', line 9

def initialize(value_matcher_factory:, operator_matcher_factory:)
  # @type [ValueMatcherFactory]
  @value_matcher_factory = value_matcher_factory
  # @type [OperatorMatcherFactory]
  @operator_matcher_factory = operator_matcher_factory
end

Instance Method Details

#matches(value, match) ⇒ boolean

Parameters:

Returns:

  • (boolean)


19
20
21
22
23
24
25
# File 'lib/hackle/internal/evaluation/match/value/value_operator_matcher.rb', line 19

def matches(value, match)
  value_matcher = @value_matcher_factory.get(match.value_type)
  operator_matcher = @operator_matcher_factory.get(match.operator)

  matches = internal_matches(value, match, value_matcher, operator_matcher)
  TargetMatchType.matches(match.type, matches)
end