Class: WSDL::XML::Attribute Private
- Inherits:
-
Object
- Object
- WSDL::XML::Attribute
- Defined in:
- lib/wsdl/xml/attribute.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents an XML attribute definition used for building SOAP messages.
Attributes are defined on complex type elements and can be either required or optional. They are rendered as XML attributes on the parent element rather than as child elements.
Instance Attribute Summary collapse
-
#base_type ⇒ String
The base type name for this attribute (e.g., 'xsd:string').
-
#list ⇒ Boolean
(also: #list?)
Whether this attribute is an xs:list type (whitespace-separated values).
-
#name ⇒ String
The local name of this attribute.
-
#use ⇒ String
The use constraint for this attribute ('optional' or 'required').
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
(also: #eql?)
private
Compares two attributes by their properties.
-
#hash ⇒ Integer
private
Hash code based on attribute properties.
-
#initialize ⇒ Attribute
constructor
private
A new instance of Attribute.
-
#optional? ⇒ Boolean
private
Returns whether this attribute is optional.
-
#to_definition_h ⇒ Hash{Symbol => Object}
private
Returns a definition-oriented hash representation.
-
#to_h ⇒ Hash{Symbol => Object}
private
Returns a hash representation of this attribute.
Constructor Details
#initialize ⇒ Attribute
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Attribute.
14 15 16 |
# File 'lib/wsdl/xml/attribute.rb', line 14 def initialize @list = false end |
Instance Attribute Details
#base_type ⇒ String
The base type name for this attribute (e.g., 'xsd:string').
26 27 28 |
# File 'lib/wsdl/xml/attribute.rb', line 26 def base_type @base_type end |
#list ⇒ Boolean Also known as: list?
Whether this attribute is an xs:list type (whitespace-separated values).
31 32 33 |
# File 'lib/wsdl/xml/attribute.rb', line 31 def list @list end |
#name ⇒ String
The local name of this attribute.
21 22 23 |
# File 'lib/wsdl/xml/attribute.rb', line 21 def name @name end |
#use ⇒ String
The use constraint for this attribute ('optional' or 'required'). Defaults to 'optional' if not specified in the schema.
38 39 40 |
# File 'lib/wsdl/xml/attribute.rb', line 38 def use @use end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Compares two attributes by their properties.
82 83 84 85 86 87 88 89 |
# File 'lib/wsdl/xml/attribute.rb', line 82 def ==(other) return false unless other.is_a?(self.class) name == other.name && base_type == other.base_type && use == other.use && list == other.list end |
#hash ⇒ Integer
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns hash code based on attribute properties.
94 95 96 |
# File 'lib/wsdl/xml/attribute.rb', line 94 def hash [name, base_type, use, list].hash end |
#optional? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns whether this attribute is optional.
43 44 45 |
# File 'lib/wsdl/xml/attribute.rb', line 43 def optional? use == 'optional' end |
#to_definition_h ⇒ Hash{Symbol => Object}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a definition-oriented hash representation.
This format preserves raw schema properties (base_type, use) rather than derived properties (type, required), making it suitable for serialization and round-trip reconstruction via Definition::ElementHash.
69 70 71 72 73 74 75 76 |
# File 'lib/wsdl/xml/attribute.rb', line 69 def to_definition_h { name:, base_type:, use:, list: list? }.freeze end |
#to_h ⇒ Hash{Symbol => Object}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a hash representation of this attribute.
Used by both Element#to_a (for paths) and PartContract (for tree) to ensure consistent attribute metadata across introspection views.
53 54 55 56 57 58 59 60 |
# File 'lib/wsdl/xml/attribute.rb', line 53 def to_h { name:, type: base_type, required: !optional?, list: list? } end |