Class: JSI::MetaschemaNode::BootstrapSchema Private
- Inherits:
-
Object
- Object
- JSI::MetaschemaNode::BootstrapSchema
- Includes:
- Schema::SchemaAncestorNode, Util::FingerprintHash, Util::Memoize
- Defined in:
- lib/jsi/metaschema_node/bootstrap_schema.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
internal class to bootstrap a metaschema. represents a schema without the complexity of JSI::Base. the schema is represented but schemas describing the schema are not.
this class is to only be instantiated on nodes in the document that are known to be schemas. Schema#subschema and Schema#resource_root_subschema are the intended mechanisms to instantiate subschemas and resolve references. #[] and #jsi_root_node are not implemented.
schema implementation modules are attached to generated subclasses of BootstrapSchema by SchemaClasses.bootstrap_schema_class. that subclass is instantiated with a document and pointer, representing a schema.
Instance Attribute Summary collapse
-
#jsi_document ⇒ Object
readonly
private
document containing the schema content.
-
#jsi_ptr ⇒ Object
readonly
private
JSI::Ptr pointing to this schema within the document.
Attributes included from Schema::SchemaAncestorNode
Class Method Summary collapse
- .inspect ⇒ Object private
- .to_s ⇒ Object private
Instance Method Summary collapse
-
#initialize(jsi_document, jsi_ptr: Ptr[], jsi_schema_base_uri: nil) ⇒ BootstrapSchema
constructor
private
A new instance of BootstrapSchema.
- #inspect ⇒ String (also: #to_s) private
- #jsi_node_content ⇒ Object private
-
#pretty_print(q) ⇒ void
private
pretty-prints a representation of self to the given printer.
Methods included from Schema::SchemaAncestorNode
#jsi_anchor_subschema, #jsi_anchor_subschemas, #jsi_resource_ancestor_uri, #jsi_schema_resource_ancestors
Constructor Details
#initialize(jsi_document, jsi_ptr: Ptr[], jsi_schema_base_uri: nil) ⇒ BootstrapSchema
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.
Returns a new instance of BootstrapSchema.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/jsi/metaschema_node/bootstrap_schema.rb', line 35 def initialize( jsi_document, jsi_ptr: Ptr[], jsi_schema_base_uri: nil ) raise(Bug, "no #schema_implementation_modules") unless respond_to?(:schema_implementation_modules) jsi_initialize_memos self.jsi_ptr = jsi_ptr self.jsi_document = jsi_document self.jsi_schema_base_uri = jsi_schema_base_uri end |
Instance Attribute Details
#jsi_document ⇒ Object (readonly)
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.
document containing the schema content
50 51 52 |
# File 'lib/jsi/metaschema_node/bootstrap_schema.rb', line 50 def jsi_document @jsi_document end |
#jsi_ptr ⇒ Object (readonly)
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.
JSI::Ptr pointing to this schema within the document
53 54 55 |
# File 'lib/jsi/metaschema_node/bootstrap_schema.rb', line 53 def jsi_ptr @jsi_ptr end |
Class Method Details
.inspect ⇒ Object
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.
22 23 24 25 26 27 28 |
# File 'lib/jsi/metaschema_node/bootstrap_schema.rb', line 22 def inspect if self == MetaschemaNode::BootstrapSchema name else "#{name || MetaschemaNode::BootstrapSchema.name} (#{schema_implementation_modules.map(&:inspect).join(', ')})" end end |
.to_s ⇒ Object
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.
30 31 32 33 34 35 36 |
# File 'lib/jsi/metaschema_node/bootstrap_schema.rb', line 30 def inspect if self == MetaschemaNode::BootstrapSchema name else "#{name || MetaschemaNode::BootstrapSchema.name} (#{schema_implementation_modules.map(&:inspect).join(', ')})" end end |
Instance Method Details
#inspect ⇒ String Also known as: to_s
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.
60 61 62 |
# File 'lib/jsi/metaschema_node/bootstrap_schema.rb', line 60 def inspect "\#<#{jsi_object_group_text.join(' ')} #{schema_content.inspect}>" end |
#jsi_node_content ⇒ Object
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.
55 56 57 |
# File 'lib/jsi/metaschema_node/bootstrap_schema.rb', line 55 def jsi_node_content jsi_ptr.evaluate(jsi_document) end |
#pretty_print(q) ⇒ void
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.
This method returns an undefined value.
pretty-prints a representation of self to the given printer
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/jsi/metaschema_node/bootstrap_schema.rb', line 68 def pretty_print(q) q.text '#<' q.text jsi_object_group_text.join(' ') q.group_sub { q.nest(2) { q.breakable ' ' q.pp schema_content } } q.breakable '' q.text '>' end |