Class: CustomElementsManifestParser::Nodes::ClassField

Inherits:
BaseStruct
  • Object
show all
Includes:
Mixins::HasParentModule, Structs::DeclarableNodeStruct, Structs::PropertyLikeStruct
Defined in:
lib/custom_elements_manifest_parser/nodes/class_field.rb

Overview

Documents a class property. This does not get used directly. Instead, it gets extended by CustomElementField.

Direct Known Subclasses

CustomElementField

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixins::HasParentModule

#parent_module

Instance Attribute Details

#inheritedFromReference?

Returns:

  • (Reference, nil)


24
# File 'lib/custom_elements_manifest_parser/nodes/class_field.rb', line 24

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

#kind'field'

Returns:

  • ('field')


16
# File 'lib/custom_elements_manifest_parser/nodes/class_field.rb', line 16

attribute :kind, Types.Value("field")

#privacyBoolean?

Returns:

  • (Boolean, nil)


20
# File 'lib/custom_elements_manifest_parser/nodes/class_field.rb', line 20

attribute :static, Types::Strict::Bool.optional.meta(required: false)

#sourceSourceReference?

Returns:

  • (SourceReference, nil)


28
# File 'lib/custom_elements_manifest_parser/nodes/class_field.rb', line 28

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

Class Method Details

.kind"field"

Returns:

  • ("field")


12
# File 'lib/custom_elements_manifest_parser/nodes/class_field.rb', line 12

def self.kind; "field"; end

Instance Method Details

#visit(parser:) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/custom_elements_manifest_parser/nodes/class_field.rb', line 38

def visit(parser:)
  hash = {}
  hash[:inheritedFrom] = parser.data_types[:inherited_from].new(inheritedFrom).visit(parser: parser) unless inheritedFrom.nil?
  hash[:source] = parser.data_types[:source].new(source).visit(parser: parser) unless source.nil?

  hash = hash.merge(
    Structs::DeclarableNodeStruct.build_hash(parser: parser, struct: self),
    Structs::PropertyLikeStruct.build_hash(parser: parser, struct: self)
  )

  new(hash)
end