Class: CustomElementsManifestParser::Structs::ClassLikeStruct
- Inherits:
-
BaseStruct
- Object
- Dry::Struct
- BaseStruct
- CustomElementsManifestParser::Structs::ClassLikeStruct
- Defined in:
- lib/custom_elements_manifest_parser/structs/class_like_struct.rb
Overview
The common interface of classes and mixins.
Instance Attribute Summary collapse
-
#deprecated ⇒ nil, ...
Whether the class or mixin is deprecated.
-
#description ⇒ String?
- A markdown description of the class.
- #members ⇒ Array<Nodes::CustomElementField, Nodes::ClassMethod>?
-
#name ⇒ String
- Name of the class.
- #source ⇒ SourceReference?
-
#summary ⇒ String?
- A markdown summary suitable for display in a listing.
-
#superclass ⇒ Reference?
- The superclass of this class.
Class Method Summary collapse
Instance Attribute Details
#deprecated ⇒ nil, ...
Returns Whether the class or mixin is deprecated. If the value is a string, it's the reason for the deprecation.
79 |
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 79 attribute :deprecated, Types::Strict::Bool | Types::Strict::String.optional.(required: false) |
#description ⇒ String?
Returns - A markdown description of the class.
18 |
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 18 attribute :description, Types::Strict::String.optional.(required: false) |
#members ⇒ Array<Nodes::CustomElementField, Nodes::ClassMethod>?
69 |
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 69 attribute :members, Types::Strict::Array.optional.(required: false) |
#name ⇒ String
Returns - Name of the class.
10 |
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 10 attribute :name, Types::Strict::String |
#source ⇒ SourceReference?
73 |
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 73 attribute :source, Types::Nominal::Any.optional.(required: false) |
#summary ⇒ String?
Returns - A markdown summary suitable for display in a listing.
14 |
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 14 attribute :summary, Types::Strict::String.optional.(required: false) |
#superclass ⇒ Reference?
Returns - The superclass of this class.
If this class is defined with mixin applications, the prototype chain includes the mixin applications and the true superclass is computed from them.
Any class mixins applied in the extends clause of this class.
29 |
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 29 attribute :superclass, Types::Nominal::Any.optional.(required: false) |
Class Method Details
.build_hash(parser:, struct:) ⇒ Object
81 82 83 84 85 86 87 88 89 |
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 81 def self.build_hash(parser:, struct:) hash = {} hash[:superclass] = parser.data_types[:superclass].new(struct.superclass).visit(parser: parser) unless struct.superclass.nil? hash[:mixins] = struct.mixins.map { |mixin| parser.data_types[:mixin].new(mixin).visit(parser: parser) } unless struct.mixins.nil? hash[:source] = parser.data_types[:source].new(struct.source).visit(parser: parser) unless struct.source.nil? hash[:members] = struct.members.map { |member| parser.visit_node(member) } unless struct.members.nil? hash end |