Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/qpid_proton/array.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#proton_array_headerObject

Used to declare an array as an AMQP array.

The value, if defined, is an instance of Qpid::Proton::ArrayHeader



62
63
64
# File 'lib/qpid_proton/array.rb', line 62

def proton_array_header
  @proton_array_header
end

Class Method Details

.proton_get(data) ⇒ Object

Gets the elements of an array or list out of the specified Qpid::Proton::Data object.

Raises:

  • (TypeError)


114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/qpid_proton/array.rb', line 114

def proton_get(data)
  raise TypeError, "can't convert nil into Qpid::Proton::Data" if data.nil?

  type = data.type

  if type == Qpid::Proton::LIST
    result = proton_get_list(data)
  elsif type == Qpid::Proton::ARRAY
    result = proton_get_array(data)
  else
    raise TypeError, "element is not a list and not an array"
  end
end

Instance Method Details

#proton_described?Boolean

Returns true if the array is the a Proton described type.

Returns:

  • (Boolean)


65
66
67
# File 'lib/qpid_proton/array.rb', line 65

def proton_described?
  !@proton_array_header.nil? && @proton_array_header.described?
end

#proton_put(data) ⇒ Object

Puts the elements of the array into the specified Qpid::Proton::Data object.

Raises:

  • (TypeError)


70
71
72
73
74
75
76
77
78
# File 'lib/qpid_proton/array.rb', line 70

def proton_put(data)
  raise TypeError, "data object cannot be nil" if data.nil?

  if @proton_array_header.nil?
    proton_put_list(data)
  else
    proton_put_array(data)
  end
end