Module: JSI::Schema::SchemaAncestorNode
- Included in:
- Base, MetaschemaNode::BootstrapSchema
- Defined in:
- lib/jsi/schema/schema_ancestor_node.rb
Overview
a node in a document which may contain a schema somewhere within is extended with SchemaAncestorNode, for tracking things necessary for a schema to function correctly
Instance Attribute Summary collapse
-
#jsi_schema_base_uri ⇒ Addressable::URI?
readonly
private
the base URI used to resolve the ids of schemas at or below this JSI.
-
#jsi_schema_registry ⇒ SchemaRegistry
readonly
See JSI::SchemaSet#new_jsi param
schema_registry
. -
#jsi_schema_resource_ancestors ⇒ Array<JSI::Schema>
readonly
private
resources which are ancestors of this JSI in the document.
Instance Method Summary collapse
- #initialize ⇒ Object
-
#jsi_anchor_subschema(anchor) ⇒ JSI::Schema?
The schema at or below this node with the given anchor.
-
#jsi_anchor_subschemas(anchor) ⇒ Set<JSI::Schema>
All schemas at or below this node with the given anchor.
-
#jsi_resource_ancestor_uri ⇒ Addressable::URI?
the URI of the resource containing this node.
Instance Attribute Details
#jsi_schema_base_uri ⇒ Addressable::URI?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
the base URI used to resolve the ids of schemas at or below this JSI. this is always an absolute URI (with no fragment). this may be the absolute schema URI of a parent schema or the URI from which the document was retrieved.
24 25 26 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 24 def jsi_schema_base_uri @jsi_schema_base_uri end |
#jsi_schema_registry ⇒ SchemaRegistry
See JSI::SchemaSet#new_jsi param schema_registry
33 34 35 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 33 def jsi_schema_registry @jsi_schema_registry end |
#jsi_schema_resource_ancestors ⇒ Array<JSI::Schema>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
resources which are ancestors of this JSI in the document. this does not include self.
29 30 31 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 29 def jsi_schema_resource_ancestors @jsi_schema_resource_ancestors end |
Instance Method Details
#initialize ⇒ Object
8 9 10 11 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 8 def initialize(*) super jsi_schema_ancestor_node_initialize end |
#jsi_anchor_subschema(anchor) ⇒ JSI::Schema?
The schema at or below this node with the given anchor. If no schema has that anchor (or multiple schemas do, incorrectly), nil.
48 49 50 51 52 53 54 55 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 48 def jsi_anchor_subschema(anchor) subschemas = @anchor_subschemas_map[anchor: anchor] if subschemas.size == 1 subschemas.first else nil end end |
#jsi_anchor_subschemas(anchor) ⇒ Set<JSI::Schema>
All schemas at or below this node with the given anchor.
60 61 62 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 60 def jsi_anchor_subschemas(anchor) @anchor_subschemas_map[anchor: anchor] end |
#jsi_resource_ancestor_uri ⇒ Addressable::URI?
the URI of the resource containing this node. this is always an absolute URI (with no fragment). if this node is a schema with an id, this is its absolute URI; otherwise a parent resource's URI, or nil if not contained by a resource with a URI.
40 41 42 |
# File 'lib/jsi/schema/schema_ancestor_node.rb', line 40 def jsi_resource_ancestor_uri (is_a?(Schema) && schema_absolute_uri) || jsi_schema_base_uri end |