Class: CustomElementsManifestParser::Nodes::CustomElementExport

Inherits:
BaseStruct
  • Object
show all
Includes:
Mixins::HasParentModule
Defined in:
lib/custom_elements_manifest_parser/nodes/custom_element_export.rb

Overview

A global custom element defintion, ie the result of a customElements.define() call.

This is represented as an export because a definition makes the element available outside of the module it's defined it.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::HasParentModule

#parent_module

Instance Attribute Details

#declarationReference

Returns A reference to the class or other declaration that implements the custom element.

Returns:

  • (Reference)

    A reference to the class or other declaration that implements the custom element.



36
# File 'lib/custom_elements_manifest_parser/nodes/custom_element_export.rb', line 36

attribute :declaration, Types::Nominal::Any

#kind"custom-element-definition"

Returns:

  • ("custom-element-definition")


21
# File 'lib/custom_elements_manifest_parser/nodes/custom_element_export.rb', line 21

attribute :kind, Types.Value("custom-element-definition")

#nameString

Returns - The tag name of the custom element.

Returns:

  • (String)
    • The tag name of the custom element


30
# File 'lib/custom_elements_manifest_parser/nodes/custom_element_export.rb', line 30

attribute :name, Types::Strict::String

Class Method Details

.kind"custom-element-definition"

Returns:

  • ("custom-element-definition")


17
# File 'lib/custom_elements_manifest_parser/nodes/custom_element_export.rb', line 17

def self.kind; "custom-element-definition"; end

Instance Method Details

#visit(parser:) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/custom_elements_manifest_parser/nodes/custom_element_export.rb', line 44

def visit(parser:)
  hash = {}
  hash[:declaration] = parser.data_types[:declaration].new(declaration).visit(parser: parser)
  hash = hash.merge(
    Structs::DeclarableNodeStruct.build_hash(parser: parser, struct: self)
  )
  new(hash)
end