Class: CustomElementsManifestParser::DataTypes::Attribute
- Inherits:
-
BaseStruct
- Object
- Dry::Struct
- BaseStruct
- CustomElementsManifestParser::DataTypes::Attribute
- Defined in:
- lib/custom_elements_manifest_parser/data_types/attribute.rb
Overview
Documents an "attribute" on a custom element.
Instance Attribute Summary collapse
-
#default ⇒ String?
- The default value of the attribute, if any.
-
#deprecated ⇒ nil, ...
- Whether the attribute is deprecated.
-
#description ⇒ String?
- A markdown description.
-
#fieldName ⇒ String?
- The name of the field this attribute is associated with, if any.
-
#inheritedFrom ⇒ Reference?
- Reference to where it inherited its attribute.
- #resolveInitializer ⇒ ResolveInitializer?
-
#summary ⇒ String?
- A markdown summary suitable for display in a listing.
-
#type ⇒ Type?
- The type that the attribute will be serialized/deserialized as.
Instance Method Summary collapse
Instance Attribute Details
#default ⇒ String?
Returns - The default value of the attribute, if any. As attributes are always strings, this is the actual value, not a human readable description.
32 |
# File 'lib/custom_elements_manifest_parser/data_types/attribute.rb', line 32 attribute :default, Types::Strict::String.optional.(required: false) |
#deprecated ⇒ nil, ...
Returns - Whether the attribute is deprecated. If the value is a string, it's the reason for the deprecation.
46 |
# File 'lib/custom_elements_manifest_parser/data_types/attribute.rb', line 46 attribute :deprecated, Types::Strict::String.optional | Types::Strict::Bool.optional.(required: false) |
#description ⇒ String?
Returns - A markdown description.
17 |
# File 'lib/custom_elements_manifest_parser/data_types/attribute.rb', line 17 attribute :description, Types::Strict::String.optional.(required: false) |
#fieldName ⇒ String?
Returns - The name of the field this attribute is associated with, if any.
36 |
# File 'lib/custom_elements_manifest_parser/data_types/attribute.rb', line 36 attribute :fieldName, Types::Strict::String.optional.(required: false) |
#inheritedFrom ⇒ Reference?
Returns - Reference to where it inherited its attribute.
21 |
# File 'lib/custom_elements_manifest_parser/data_types/attribute.rb', line 21 attribute :inheritedFrom, Types::Nominal::Any.optional.(required: false) |
#resolveInitializer ⇒ ResolveInitializer?
40 |
# File 'lib/custom_elements_manifest_parser/data_types/attribute.rb', line 40 attribute :resolveInitializer, Types::Nominal::Any.optional.(required: false) |
#summary ⇒ String?
Returns - A markdown summary suitable for display in a listing.
13 |
# File 'lib/custom_elements_manifest_parser/data_types/attribute.rb', line 13 attribute :summary, Types::Strict::String.optional.(required: false) |
Instance Method Details
#visit(parser:) ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/custom_elements_manifest_parser/data_types/attribute.rb', line 48 def visit(parser:) hash = {} hash[:inheritedFrom] = parser.data_types[:inherited_from].new(inheritedFrom).visit(parser: parser) unless inheritedFrom.nil? hash[:type] = parser.data_types[:type].new(type).visit(parser: parser) unless type.nil? hash[:resolveInitializer] = parser.data_types[:resolve_initializer].new(resolveInitializer).visit(parser: parser) unless resolveInitializer.nil? new(hash) end |