class Qpid::Proton::Types::UniformArray

*Unsettled API* - An array that is converted to/from an AMQP array of uniform element type. A plain ruby ::Array is converted to/from an AMQP list, which can contain mixed type elements. If invalid elements are included, then {TypeError} will be raised when encoding to AMQP.

Attributes

descriptor[R]

@return [Object] Optional descriptor.

type[R]

@return [Type] Array elements must be convertible to this AMQP type

Public Class Methods

new(type, elements=nil, descriptor=nil) click to toggle source

Construct a uniform array, which will be converted to an AMQP array. A plain ruby ::Array is converted to/from an AMQP list, containing mixed type elements.

@param type [Type] Elements must be convertible to this AMQP type. @param elements [Enumerator] Initial elements for the array @param descriptor [Object] Optional array descriptor

Calls superclass method
# File lib/types/array.rb, line 50
def initialize(type, elements=nil, descriptor=nil)
  @type, @descriptor = type, descriptor
  @proton_array_header = nil
  raise ArgumentError, "no type specified for array" if @type.nil?
  super elements if elements
end

Public Instance Methods

<=>(x) click to toggle source
Calls superclass method
# File lib/types/array.rb, line 70
def <=>(x)
  ret = [@type, @descriptor] <=> [x.type, x.descriptor]
  ret == 0 ? super : ret
end
inspect() click to toggle source
# File lib/types/array.rb, line 68
def inspect() "#{self.class.name}<#{type}>#{super}"; end
proton_array_header() click to toggle source

@deprecated backwards compatibility {UniformArray}

# File lib/types/array.rb, line 58
def proton_array_header
  @proton_array_header ||= ArrayHeader.new(@type, @descriptor) # Deprecated
end