Sha256: bf94cce1afcb3f1df87d14749e2da1b2c813e38a4449c1051bd50336f25afa49
Contents?: true
Size: 783 Bytes
Versions: 1
Compression:
Stored size: 783 Bytes
Contents
require 'addressable/uri' require 'jschematic/element' module Jschematic module Attributes class Extends include Jschematic::Element def initialize(id_or_schema_or_array_of_schemas) @schema = id_or_schema_or_array_of_schemas end def accepts?(instance) case @schema when String uri = Addressable::URI.parse(@schema) schema = schema_for(uri) schema.accepts?(instance) when Hash Schema.new(@schema).accepts?(instance) when Array @schema.all? do |schema| extends = Extends.new(schema) extends.parent = self extends.accepts?(instance) end end || fail_validation!(@schema, instance) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jschematic-0.1.0 | lib/jschematic/attributes/extends.rb |