Class: Pact::Matchers::V3::DateTime

Inherits:
Base show all
Defined in:
lib/pact/matchers/v3/date_time.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(format, template) ⇒ DateTime

Returns a new instance of DateTime.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pact/matchers/v3/date_time.rb', line 7

def initialize(format, template)
  unless template.is_a?(String)
    raise MatcherInitializationError,
          "#{self.class}: #{format} should be an instance of String"
  end
  unless template.is_a?(String)
    raise MatcherInitializationError,
          "#{self.class}: #{template} should be an instance of String"
  end

  super(spec_version: Pact::Matchers::PACT_SPEC_V3, kind: 'datetime', template: template, opts: { format: format }) # rubocop:disable Layout/LineLength
end