Class: Pact::Matchers::V2::Type

Inherits:
Base show all
Defined in:
lib/pact/matchers/v2/type.rb

Instance Attribute Summary

Attributes inherited from Base

#kind, #opts, #spec_version, #template

Instance Method Summary collapse

Methods inherited from Base

#as_basic, #as_plugin

Constructor Details

#initialize(template) ⇒ Type

Returns a new instance of Type.



7
8
9
10
11
12
13
14
# File 'lib/pact/matchers/v2/type.rb', line 7

def initialize(template)
  unless template.is_a?(TrueClass) || template.is_a?(FalseClass) || template.is_a?(Numeric) || template.is_a?(String) || template.is_a?(Array) || template.is_a?(Hash) # rubocop:disable Layout/LineLength
    raise MatcherInitializationError,
          "#{self.class}: template is not a primitive"
  end

  super(spec_version: Pact::Matchers::PACT_SPEC_V2, kind: 'type', template: template)
end