Class: CustomElementsManifestParser::Structs::FunctionLikeStruct

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

Overview

An interface for functions / methods.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#deprecatedBoolean, ...

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

Returns:

  • (Boolean, String, nil)

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



24
# File 'lib/custom_elements_manifest_parser/structs/function_like_struct.rb', line 24

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

#descriptionString?

Returns - A markdown description.

Returns:

  • (String, nil)
    • A markdown description.


18
# File 'lib/custom_elements_manifest_parser/structs/function_like_struct.rb', line 18

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

#nameString?

Returns - Name of the function.

Returns:

  • (String, nil)
    • Name of the function


10
# File 'lib/custom_elements_manifest_parser/structs/function_like_struct.rb', line 10

attribute :name, Types::Strict::String.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.


14
# File 'lib/custom_elements_manifest_parser/structs/function_like_struct.rb', line 14

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

Class Method Details

.build_hash(parser:, struct:) ⇒ Object



32
33
34
35
36
37
# File 'lib/custom_elements_manifest_parser/structs/function_like_struct.rb', line 32

def self.build_hash(parser:, struct:)
  hash = {}
  hash[:parameters] = struct.parameters.map { |parameter| parser.data_types[:parameter].new(parameter).visit(parser: parser) } if struct.parameters
  hash[:return] = parser.data_types[:function_return_type].new(struct.return).visit(parser: parser) if struct.return
  hash
end