Class: Pact::MatchingRules::Merge
- Inherits:
-
Object
- Object
- Pact::MatchingRules::Merge
- Defined in:
- lib/pact/matching_rules/merge.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(expected, matching_rules, root_path) ⇒ Merge
constructor
A new instance of Merge.
Constructor Details
#initialize(expected, matching_rules, root_path) ⇒ Merge
Returns a new instance of Merge.
12 13 14 15 16 17 |
# File 'lib/pact/matching_rules/merge.rb', line 12 def initialize expected, matching_rules, root_path @expected = expected @matching_rules = standardise_paths(matching_rules) @root_path = JsonPath.new(root_path).to_s @used_rules = [] end |
Class Method Details
.call(expected, matching_rules, root_path = '$') ⇒ Object
8 9 10 |
# File 'lib/pact/matching_rules/merge.rb', line 8 def self.call expected, matching_rules, root_path = '$' new(expected, matching_rules, root_path).call end |
Instance Method Details
#call ⇒ Object
19 20 21 22 |
# File 'lib/pact/matching_rules/merge.rb', line 19 def call return @expected if @matching_rules.nil? || @matching_rules.empty? recurse(@expected, @root_path).tap { log_ignored_rules } end |