Class: Pact::V2::Matchers::V3::ContentType
- Defined in:
- lib/pact/v2/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.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pact/v2/matchers/v3/content_type.rb', line 8 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::V2::Matchers::PACT_SPEC_V3, kind: "contentType", template: content_type, opts: @opts ) end |
Instance Method Details
#as_plugin ⇒ Object
25 26 27 |
# File 'lib/pact/v2/matchers/v3/content_type.rb', line 25 def as_plugin "matching(contentType, '#{@content_type}', '#{@opts[:plugin_template]}')" end |