Class: Pact::V2::Matchers::V3::Semver

Inherits:
Base
  • Object
show all
Defined in:
lib/pact/v2/matchers/v3/semver.rb

Instance Attribute Summary

Attributes inherited from Base

#kind, #opts, #spec_version, #template

Instance Method Summary collapse

Methods inherited from Base

#as_basic

Constructor Details

#initialize(template = nil) ⇒ Semver

Returns a new instance of Semver.



8
9
10
11
# File 'lib/pact/v2/matchers/v3/semver.rb', line 8

def initialize(template = nil)
  @template = template
  super(spec_version: Pact::V2::Matchers::PACT_SPEC_V3, kind: "semver", template: template)
end

Instance Method Details

#as_pluginObject



13
14
15
16
17
18
# File 'lib/pact/v2/matchers/v3/semver.rb', line 13

def as_plugin
  if @template.nil? || @template.blank?
    raise MatcherInitializationError, "#{self.class}: template must be provided when calling as_plugin"
  end
  "matching(semver, '#{@template}')"
end