Class: CustomElementsManifestParser::DataTypes::Demo

Inherits:
BaseStruct
  • Object
show all
Defined in:
lib/custom_elements_manifest_parser/data_types/demo.rb

Overview

Links to a demo of the element

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionString?

Returns - A markdown description of the demo.

Returns:

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


16
# File 'lib/custom_elements_manifest_parser/data_types/demo.rb', line 16

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

#sourceSourceReference?

Returns:



20
# File 'lib/custom_elements_manifest_parser/data_types/demo.rb', line 20

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

#urlString

Returns - Relative URL of the demo if it's published with the package. Absolute URL if it's hosted.

Returns:

  • (String)

    - Relative URL of the demo if it's published with the package. Absolute URL if it's hosted.



12
# File 'lib/custom_elements_manifest_parser/data_types/demo.rb', line 12

attribute :url, Types::Strict::String

Instance Method Details

#visit(parser:) ⇒ Object



22
23
24
25
26
# File 'lib/custom_elements_manifest_parser/data_types/demo.rb', line 22

def visit(parser:)
  hash = {}
  hash[:source] = parser.data_types[:source].new(source).visit(parser: parser) if source
  new(hash)
end