Sha256: 13fdb2232ae1052180863f41a7b0a6c6037ec08bbde76df3c0631981b75e462a
Contents?: true
Size: 520 Bytes
Versions: 1
Compression:
Stored size: 520 Bytes
Contents
require 'jschematic/element' module Jschematic module Attributes class PatternProperties include Jschematic::Element def initialize(schema) @schema = schema end def accepts?(instance) instance.all? do |property, value| if match = @schema.find{ |re, schema| property =~ Regexp.new(re) } Schema.new(match[1]).accepts?(value) else false end end || fail_validation!(@schema, instance) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jschematic-0.0.1 | lib/jschematic/attributes/pattern_properties.rb |