Sha256: 0fa0cc9d1adee63380f7928d18f6df8705b7ecd7523cab7e22a7825e61f990a8
Contents?: true
Size: 399 Bytes
Versions: 6
Compression:
Stored size: 399 Bytes
Contents
require 'jschematic/element' module Jschematic module Attributes class Pattern include Jschematic::Element def initialize(pattern) @pattern = Regexp.new(pattern) end def accepts?(instance) return true unless String === instance instance.match(@pattern) || fail_validation!("string matching #{@pattern}", instance) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems