class Hash
Public Instance Methods
proton_data_get(data)
click to toggle source
# File lib/qpid_proton/hash.rb, line 57 def proton_data_get(data) raise TypeError, "data object cannot be nil" if data.nil? type = data.type raise TypeError, "element is not a map" unless type == Qpid::Proton::MAP count = data.map result = {} data.enter (0...(count/2)).each do data.next type = data.type key = type.get(data) data.next type = data.type value = type.get(data) result[key] = value end data.exit return result end
proton_data_put(data)
click to toggle source
Places the contents of the hash into the specified data object.
Arguments¶ ↑
-
data - the Qpid::Proton::Data instance
Examples¶ ↑
data = Qpid::Proton::Data.new values = {:foo => :bar} values.proton_data_put(data)
# File lib/qpid_proton/hash.rb, line 39 def proton_data_put(data) raise TypeError, "data object cannot be nil" if data.nil? data.put_map data.enter each_pair do |key, value| type = Qpid::Proton::Mapping.for_class(key.class) type.put(data, key) type = Qpid::Proton::Mapping.for_class(value.class) type.put(data, value) end data.exit end