Class: WSDL::Definition::AttributeHash Private

Inherits:
Object
  • Object
show all
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.

API:

  • private

Instance Method Summary collapse

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.

Parameters:

API:

  • private



154
155
156
157
# File 'lib/wsdl/definition/element_hash.rb', line 154

def initialize(data)
  @data = data
  freeze
end

Instance Method Details

#base_typeString

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').

Returns:

  • base type name (e.g. 'xsd:string')

API:

  • private



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.

Returns:

  • true if this is an xs:list type

API:

  • private



170
171
172
# File 'lib/wsdl/definition/element_hash.rb', line 170

def list?
  @data[:list]
end

#nameString

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.

Returns:

  • attribute name

API:

  • private



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.

Returns:

  • true if the attribute is optional

API:

  • private



180
181
182
# File 'lib/wsdl/definition/element_hash.rb', line 180

def optional?
  @data[:use] == 'optional'
end

#to_definition_hHash{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.

Returns:

  • the underlying definition data

API:

  • private



192
193
194
# File 'lib/wsdl/definition/element_hash.rb', line 192

def to_definition_h
  @data
end

#to_hHash{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.

Returns:

  • attribute metadata

API:

  • private



187
188
189
# File 'lib/wsdl/definition/element_hash.rb', line 187

def to_h
  { name:, type: base_type, required: !optional?, list: list? }
end

#useString

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').

Returns:

  • use constraint ('optional' or 'required')

API:

  • private



175
176
177
# File 'lib/wsdl/definition/element_hash.rb', line 175

def use
  @data[:use]
end