Sha256: d0998f9419b4a2827d70136d7bbd13002830433e4fee612d26b3d7b6717ec5ef
Contents?: true
Size: 828 Bytes
Versions: 3
Compression:
Stored size: 828 Bytes
Contents
# frozen_string_literal: true module Sbmt module Pact module Matchers module V2 class Regex < Sbmt::Pact::Matchers::Base def initialize(regex, template) raise MatcherInitializationError, "#{self.class}: #{regex} should be an instance of Regexp" unless regex.is_a?(Regexp) raise MatcherInitializationError, "#{self.class}: #{template} should be an instance of String or Array" unless template.is_a?(String) || template.is_a?(Array) raise MatcherInitializationError, "#{self.class}: #{template} array values should be strings" if template.is_a?(Array) && !template.all?(String) super(spec_version: Sbmt::Pact::Matchers::PACT_SPEC_V2, kind: "regex", template: template, opts: {regex: regex.to_s}) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
sbmt-pact-0.12.2 | lib/sbmt/pact/matchers/v2/regex.rb |
sbmt-pact-0.12.1 | lib/sbmt/pact/matchers/v2/regex.rb |
sbmt-pact-0.12.0 | lib/sbmt/pact/matchers/v2/regex.rb |