Class: Qpid::Proton::Types::UniformArray
- Inherits:
-
Array
- Object
- Array
- Qpid::Proton::Types::UniformArray
- Defined in:
- lib/types/array.rb
Overview
*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.
Instance Attribute Summary collapse
-
#descriptor ⇒ Object
readonly
Optional descriptor.
-
#type ⇒ Type
readonly
Array elements must be convertible to this AMQP type.
Instance Method Summary collapse
- #<=>(x)
-
#initialize(type, elements = nil, descriptor = nil) ⇒ UniformArray
constructor
Construct a uniform array, which will be converted to an AMQP array.
- #inspect
-
#proton_array_header
deprecated
Deprecated.
backwards compatibility UniformArray
Constructor Details
#initialize(type, elements = nil, descriptor = nil) ⇒ UniformArray
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.
50 51 52 53 54 55 |
# 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 |
Instance Attribute Details
#descriptor ⇒ Object (readonly)
Returns Optional descriptor.
66 67 68 |
# File 'lib/types/array.rb', line 66 def descriptor @descriptor end |
#type ⇒ Type (readonly)
Returns Array elements must be convertible to this AMQP type.
63 64 65 |
# File 'lib/types/array.rb', line 63 def type @type end |
Instance Method Details
#<=>(x)
70 71 72 73 |
# File 'lib/types/array.rb', line 70 def <=>(x) ret = [@type, @descriptor] <=> [x.type, x.descriptor] ret == 0 ? super : ret end |
#inspect
68 |
# File 'lib/types/array.rb', line 68 def inspect() "#{self.class.name}<#{type}>#{super}"; end |
#proton_array_header
backwards compatibility Qpid::Proton::Types::UniformArray
58 59 60 |
# File 'lib/types/array.rb', line 58 def proton_array_header @proton_array_header ||= ArrayHeader.new(@type, @descriptor) # Deprecated end |