Class: Pact::V2::Matchers::V4::NotEmpty

Inherits:
Base
  • Object
show all
Defined in:
lib/pact/v2/matchers/v4/not_empty.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) ⇒ NotEmpty

Returns a new instance of NotEmpty.



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

def initialize(template = nil)
  @template = template
  super(spec_version: Pact::V2::Matchers::PACT_SPEC_V4, kind: 'notEmpty', template: @template)
end

Instance Method Details

#as_pluginObject



13
14
15
16
17
18
19
# File 'lib/pact/v2/matchers/v4/not_empty.rb', line 13

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

  "notEmpty('#{@template}')"
end