Class: Scorpio::ResourceBase::Container
- Inherits:
-
Object
- Object
- Scorpio::ResourceBase::Container
- Includes:
- Containment
- Defined in:
- lib/scorpio/resource_base.rb,
lib/scorpio/resource_base.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#contained_object ⇒ Object
(also: #jsi_node_content)
readonly
Returns the value of attribute contained_object.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(contained_object, openapi_document_class, options = {}) ⇒ Container
constructor
A new instance of Container.
- #jsi_object_group_text ⇒ Array<String>
Methods included from Containment
#[], #[]=, #as_json, #inspect, #jsi_fingerprint, #pretty_print
Constructor Details
#initialize(contained_object, openapi_document_class, options = {}) ⇒ Container
Returns a new instance of Container.
589 590 591 592 593 594 |
# File 'lib/scorpio/resource_base.rb', line 589 def initialize(contained_object, openapi_document_class, = {}) @contained_object = contained_object @openapi_document_class = openapi_document_class @options = @subscript_memos = {} end |
Instance Attribute Details
#contained_object ⇒ Object (readonly) Also known as: jsi_node_content
Returns the value of attribute contained_object.
596 597 598 |
# File 'lib/scorpio/resource_base.rb', line 596 def contained_object @contained_object end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
598 599 600 |
# File 'lib/scorpio/resource_base.rb', line 598 def @options end |
Class Method Details
.new_container(object, openapi_document_class, options = {}) ⇒ Object
517 518 519 520 521 522 523 524 525 526 527 528 529 530 |
# File 'lib/scorpio/resource_base.rb', line 517 def new_container(object, openapi_document_class, = {}) container_modules = Set[] if object.respond_to?(:to_hash) container_modules << Container::Hash end if object.respond_to?(:to_ary) container_modules << Container::Array end container_class = @container_classes[{modules: container_modules.freeze, schemas: object.jsi_schemas}] container_class.new(object, openapi_document_class, ) end |
Instance Method Details
#jsi_object_group_text ⇒ Array<String>
606 607 608 609 610 611 612 613 |
# File 'lib/scorpio/resource_base.rb', line 606 def jsi_object_group_text schema_names = contained_object.jsi_schemas.map { |schema| schema.jsi_schema_module.name_from_ancestor || schema.schema_uri }.compact if schema_names.empty? [Container.to_s] else ["#{Container} (#{schema_names.join(', ')})"] end end |