Sha256: 0a2572dcf4733943a131c80782bdfc54e5238defcd7db22a45951e4c54ea78bb
Contents?: true
Size: 450 Bytes
Versions: 2
Compression:
Stored size: 450 Bytes
Contents
require 'string_pattern' module Pact module Generator # Regex provides the regex generator which will generate a value based on the regex pattern provided class Regex def can_generate?(hash) hash.key?('type') && hash['type'] == 'Regex' end def call(hash, _params = nil, _example_value = nil) pattern = hash['pattern'] || '' StringPattern.generate(Regexp.new(pattern)) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pact-support-1.21.1 | lib/pact/generator/regex.rb |
pact-support-1.21.0 | lib/pact/generator/regex.rb |