Class: CustomElementsManifestParser::Structs::PropertyLikeStruct

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

Overview

The common interface of variables, class fields, and function parameters.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#defaultString?

Returns - Default value.

Returns:

  • (String, nil)
    • Default value


27
# File 'lib/custom_elements_manifest_parser/structs/property_like_struct.rb', line 27

attribute :default, Types::Strict::String.optional.meta(required: false)

#deprecatednil, ...

Returns - Whether the property is deprecated. If the value is a string, it's the reason for the deprecation.

Returns:

  • (nil, Boolean, String)

    - Whether the property is deprecated. If the value is a string, it's the reason for the deprecation.



33
# File 'lib/custom_elements_manifest_parser/structs/property_like_struct.rb', line 33

attribute :deprecated, Types::Strict::Bool.optional | Types::Strict::String.optional.meta(required: false)

#descriptionString?

Returns - A markdown description of the field.

Returns:

  • (String, nil)
    • A markdown description of the field.


19
# File 'lib/custom_elements_manifest_parser/structs/property_like_struct.rb', line 19

attribute :description, Types::Strict::String.optional.meta(required: false)

#nameString

Returns - Name of the property.

Returns:

  • (String)
    • Name of the property


11
# File 'lib/custom_elements_manifest_parser/structs/property_like_struct.rb', line 11

attribute :name, Types::Strict::String

#readonlynil, Boolean

Returns - Whether the property is read-only.

Returns:

  • (nil, Boolean)
    • Whether the property is read-only.


37
# File 'lib/custom_elements_manifest_parser/structs/property_like_struct.rb', line 37

attribute :readonly, Types::Strict::Bool.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.


15
# File 'lib/custom_elements_manifest_parser/structs/property_like_struct.rb', line 15

attribute :summary, Types::Strict::String.optional.meta(required: false)

#typenil, Type

Returns - The type serializer IE: "Object", "String", etc.

Returns:

  • (nil, Type)
    • The type serializer IE: "Object", "String", etc.


23
# File 'lib/custom_elements_manifest_parser/structs/property_like_struct.rb', line 23

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

Class Method Details

.build_hash(parser:, struct:) ⇒ Object



39
40
41
42
43
# File 'lib/custom_elements_manifest_parser/structs/property_like_struct.rb', line 39

def self.build_hash(parser:, struct:)
  hash = {}
  hash[:type] = parser.data_types[:type].new(struct.type).visit(parser: parser) if struct.type
  hash
end