Class: CustomElementsManifestParser::Structs::ClassLikeStruct

Inherits:
BaseStruct
  • Object
show all
Defined in:
lib/custom_elements_manifest_parser/structs/class_like_struct.rb

Overview

The common interface of classes and mixins.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#deprecatednil, ...

Returns Whether the class or mixin is deprecated. If the value is a string, it's the reason for the deprecation.

Returns:

  • (nil, boolean, string)

    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.meta(required: false)

#descriptionString?

Returns - A markdown description of the class.

Returns:

  • (String, nil)
    • 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.meta(required: false)

#membersArray<Nodes::CustomElementField, Nodes::ClassMethod>?



69
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 69

attribute :members, Types::Strict::Array.optional.meta(required: false)

#nameString

Returns - Name of the class.

Returns:

  • (String)
    • Name of the class


10
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 10

attribute :name, Types::Strict::String

#sourceSourceReference?

Returns:

  • (SourceReference, nil)


73
# File 'lib/custom_elements_manifest_parser/structs/class_like_struct.rb', line 73

attribute :source, Types::Nominal::Any.optional.meta(required: false)

#summaryString?

Returns - A markdown summary suitable for display in a listing.

Returns:

  • (String, nil)
    • 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.meta(required: false)

#superclassReference?

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.

Returns:

  • (Reference, nil)

    - 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.meta(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