Class: Pact::Matchers::V3::ContentType
- Defined in:
- lib/pact/matchers/v3/content_type.rb
Instance Attribute Summary
Attributes inherited from Base
#kind, #opts, #spec_version, #template
Instance Method Summary collapse
- #as_plugin ⇒ Object
-
#initialize(content_type, template: nil) ⇒ ContentType
constructor
A new instance of ContentType.
Methods inherited from Base
Constructor Details
#initialize(content_type, template: nil) ⇒ ContentType
Returns a new instance of ContentType.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/pact/matchers/v3/content_type.rb', line 7 def initialize(content_type, template: nil) @content_type = content_type @template = template @opts = {} @opts[:plugin_template] = template unless template.nil? unless content_type.is_a?(String) && !content_type.empty? raise MatcherInitializationError, "#{self.class}: content_type must be a non-empty String" end super( spec_version: Pact::Matchers::PACT_SPEC_V3, kind: 'contentType', template: content_type, opts: @opts ) end |
Instance Method Details
#as_plugin ⇒ Object
24 25 26 |
# File 'lib/pact/matchers/v3/content_type.rb', line 24 def as_plugin "matching(contentType, '#{@content_type}', '#{@opts[:plugin_template]}')" end |