Class: Pact::Matchers::V4::EachKeyValue
- Defined in:
- lib/pact/matchers/v4/each_key_value.rb
Instance Attribute Summary
Attributes inherited from Base
#kind, #opts, #spec_version, #template
Instance Method Summary collapse
- #as_plugin ⇒ Object
-
#initialize(key_matchers, template) ⇒ EachKeyValue
constructor
A new instance of EachKeyValue.
Methods inherited from Base
Constructor Details
#initialize(key_matchers, template) ⇒ EachKeyValue
Returns a new instance of EachKeyValue.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pact/matchers/v4/each_key_value.rb', line 7 def initialize(key_matchers, template) raise MatcherInitializationError, "#{self.class}: #{template} should be a Hash" unless template.is_a?(Hash) unless key_matchers.is_a?(Array) raise MatcherInitializationError, "#{self.class}: #{key_matchers} should be an Array" end unless key_matchers.all?(Pact::Matchers::Base) raise MatcherInitializationError, "#{self.class}: #{key_matchers} should be instances of Pact::Matchers::Base" end super( spec_version: Pact::Matchers::PACT_SPEC_V4, kind: [ EachKey.new(key_matchers, {}), EachValue.new([Pact::Matchers::V2::Type.new('')], {}) ], template: template ) @key_matchers = key_matchers end |
Instance Method Details
#as_plugin ⇒ Object
31 32 33 34 |
# File 'lib/pact/matchers/v4/each_key_value.rb', line 31 def as_plugin raise MatcherInitializationError, "#{self.class}: each-key-value is not supported in plugin syntax. Use each / each_key / each_value matchers instead" # rubocop:disable Layout/LineLength end |