Class: JSI::NotASchemaModule
- Inherits:
-
Object
- Object
- JSI::NotASchemaModule
- Includes:
- SchemaModulePossibly
- Defined in:
- lib/jsi/schema_classes.rb
Overview
a schema module is a module which represents a schema. a NotASchemaModule represents a node in a schema's document which is not a schema, such as the 'properties' node (which contains schemas but is not a schema).
a NotASchemaModule is extended with the module_for_schema of the node's schema.
NotASchemaModule holds a node which is not a schema. when subscripted, it subscripts its node. if the value is a JSI::Schema, its schema module is returned. if the value is another node, a NotASchemaModule for that node is returned. otherwise - when the value is a basic type - that value itself is returned.
Instance Attribute Summary
Attributes included from SchemaModulePossibly
Instance Method Summary collapse
-
#initialize(node) ⇒ NotASchemaModule
constructor
A new instance of NotASchemaModule.
Methods included from SchemaModulePossibly
Constructor Details
#initialize(node) ⇒ NotASchemaModule
Returns a new instance of NotASchemaModule.
143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/jsi/schema_classes.rb', line 143 def initialize(node) unless node.is_a?(JSI::PathedNode) raise(TypeError, "not JSI::PathedNode: #{node.pretty_inspect.chomp}") end if node.is_a?(JSI::Schema) raise(TypeError, "cannot instantiate NotASchemaModule for a JSI::Schema node: #{node.pretty_inspect.chomp}") end @possibly_schema_node = node node.jsi_schemas.each do |schema| extend(JSI::SchemaClasses.accessor_module_for_schema(schema, conflicting_modules: [NotASchemaModule, SchemaModulePossibly])) end end |