Class: WSDL::Definition::AttributeHash Private
- Inherits:
-
Object
- Object
- WSDL::Definition::AttributeHash
- Defined in:
- lib/wsdl/definition/element_hash.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.
Frozen wrapper around a plain attribute hash that duck-types as XML::Attribute.
Instance Method Summary collapse
-
#base_type ⇒ String
private
Base type name (e.g. 'xsd:string').
-
#initialize(data) ⇒ AttributeHash
constructor
private
A new instance of AttributeHash.
-
#list? ⇒ Boolean
private
True if this is an xs:list type.
-
#name ⇒ String
private
Attribute name.
-
#optional? ⇒ Boolean
private
True if the attribute is optional.
-
#to_definition_h ⇒ Hash{Symbol => Object}
private
The underlying definition data.
-
#to_h ⇒ Hash{Symbol => Object}
private
Returns an introspection-compatible hash matching XML::Attribute#to_h.
-
#use ⇒ String
private
Use constraint ('optional' or 'required').
Constructor Details
#initialize(data) ⇒ AttributeHash
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 AttributeHash.
154 155 156 157 |
# File 'lib/wsdl/definition/element_hash.rb', line 154 def initialize(data) @data = data freeze end |
Instance Method Details
#base_type ⇒ String
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 base type name (e.g. 'xsd:string').
165 166 167 |
# File 'lib/wsdl/definition/element_hash.rb', line 165 def base_type @data[:base_type] end |
#list? ⇒ 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 true if this is an xs:list type.
170 171 172 |
# File 'lib/wsdl/definition/element_hash.rb', line 170 def list? @data[:list] end |
#name ⇒ String
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 attribute name.
160 161 162 |
# File 'lib/wsdl/definition/element_hash.rb', line 160 def name @data[:name] 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 true if the attribute is optional.
180 181 182 |
# File 'lib/wsdl/definition/element_hash.rb', line 180 def optional? @data[: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 the underlying definition data.
192 193 194 |
# File 'lib/wsdl/definition/element_hash.rb', line 192 def to_definition_h @data 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 an introspection-compatible hash matching XML::Attribute#to_h.
187 188 189 |
# File 'lib/wsdl/definition/element_hash.rb', line 187 def to_h { name:, type: base_type, required: !optional?, list: list? } end |
#use ⇒ String
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 use constraint ('optional' or 'required').
175 176 177 |
# File 'lib/wsdl/definition/element_hash.rb', line 175 def use @data[:use] end |