Module: JSI::SchemaModulePossibly
- Included in:
- NotASchemaModule
- Defined in:
- lib/jsi/schema_classes.rb
Overview
a JSI::Schema module and a JSI::NotASchemaModule are both a SchemaModulePossibly. this module provides a #[] method.
Instance Attribute Summary collapse
-
#possibly_schema_node ⇒ Object
readonly
Returns the value of attribute possibly_schema_node.
Instance Method Summary collapse
-
#[](token) ⇒ Class, ...
subscripting a JSI schema module or a NotASchemaModule will subscript the node, and if the result is a JSI::Schema, return a JSI::Schema class; if it is a PathedNode, return a NotASchemaModule; or if it is another value (a basic type), return that value.
Instance Attribute Details
#possibly_schema_node ⇒ Object (readonly)
Returns the value of attribute possibly_schema_node.
111 112 113 |
# File 'lib/jsi/schema_classes.rb', line 111 def possibly_schema_node @possibly_schema_node end |
Instance Method Details
#[](token) ⇒ Class, ...
subscripting a JSI schema module or a NotASchemaModule will subscript the node, and if the result is a JSI::Schema, return a JSI::Schema class; if it is a PathedNode, return a NotASchemaModule; or if it is another value (a basic type), return that value.
119 120 121 122 123 124 125 126 127 128 |
# File 'lib/jsi/schema_classes.rb', line 119 def [](token) sub = @possibly_schema_node[token] if sub.is_a?(JSI::Schema) sub.jsi_schema_module elsif sub.is_a?(JSI::PathedNode) NotASchemaModule.new(sub) else sub end end |