Class: CustomElementsManifestParser::DataTypes::Parameter

Inherits:
BaseStruct
  • Object
show all
Includes:
Structs::PropertyLikeStruct
Defined in:
lib/custom_elements_manifest_parser/data_types/parameter.rb

Overview

Documents a parameter on a function

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionalBoolean?

Returns - Whether the parameter is optional. Undefined implies non-optional.

Returns:

  • (Boolean, nil)
    • Whether the parameter is optional. Undefined implies non-optional.


15
# File 'lib/custom_elements_manifest_parser/data_types/parameter.rb', line 15

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

#restBoolean?

Returns - Whether the parameter is a rest parameter. Only the last parameter may be a rest parameter. Undefined implies single parameter.

Returns:

  • (Boolean, nil)

    - Whether the parameter is a rest parameter. Only the last parameter may be a rest parameter. Undefined implies single parameter.



21
# File 'lib/custom_elements_manifest_parser/data_types/parameter.rb', line 21

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

Instance Method Details

#visit(parser:) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/custom_elements_manifest_parser/data_types/parameter.rb', line 23

def visit(parser:)
  hash = {}

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