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.

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:



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

Returns:

  • (String) —

    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.

Returns:

  • (Boolean) —

    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.

Returns:

  • (String) —

    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.

Returns:

  • (Boolean) —

    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.

Returns:

  • (Hash{Symbol => Object}) —

    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.

Returns:

  • (Hash{Symbol => Object}) —

    attribute metadata



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

Returns:

  • (String) —

    use constraint ('optional' or 'required')



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

def use
  @data[:use]
end