Class: Pact::MatchingRules::V3::Merge

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/matching_rules/v3/merge.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected, matching_rules, root_path) ⇒ Merge

Returns a new instance of Merge.



13
14
15
16
17
# File 'lib/pact/matching_rules/v3/merge.rb', line 13

def initialize expected, matching_rules, root_path
  @expected = expected
  @matching_rules = standardise_paths(matching_rules)
  @root_path = JsonPath.new(root_path).to_s
end

Class Method Details

.call(expected, matching_rules, root_path = '$') ⇒ Object



9
10
11
# File 'lib/pact/matching_rules/v3/merge.rb', line 9

def self.call expected, matching_rules, root_path = '$'
  new(expected, matching_rules, root_path).call
end

Instance Method Details

#callObject



19
20
21
22
# File 'lib/pact/matching_rules/v3/merge.rb', line 19

def call
  return @expected if @matching_rules.nil? || @matching_rules.empty?
  recurse(@expected, @root_path).tap { log_ignored_rules }
end