Class: Jschematic::Attributes::Ref
- Inherits:
-
Object
- Object
- Jschematic::Attributes::Ref
- Includes:
- Element
- Defined in:
- lib/jschematic/attributes/ref.rb
Instance Attribute Summary
Attributes included from Element
Instance Method Summary collapse
- #accepts?(instance) ⇒ Boolean
-
#initialize(uri) ⇒ Ref
constructor
A new instance of Ref.
Methods included from Element
#required?, #schema_for, #title, #to_s
Constructor Details
#initialize(uri) ⇒ Ref
Returns a new instance of Ref.
10 11 12 |
# File 'lib/jschematic/attributes/ref.rb', line 10 def initialize(uri) @uri = Addressable::URI.parse(uri) end |
Instance Method Details
#accepts?(instance) ⇒ Boolean
14 15 16 17 |
# File 'lib/jschematic/attributes/ref.rb', line 14 def accepts?(instance) schema = schema_for(@uri) || raise(SchemaNotFoundError.new(@uri)) schema.accepts?(instance) end |