lib/qpid_proton/data.rb in qpid_proton-0.8 vs lib/qpid_proton/data.rb in qpid_proton-0.9.0
- old
+ new
@@ -1,6 +1,6 @@
-#
+#--
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
@@ -13,18 +13,16 @@
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-#
+#++
-require 'cproton'
+module Qpid # :nodoc:
-module Qpid
+ module Proton # :nodoc:
- module Proton
-
# +DataError+ is raised when an error occurs while encoding
# or decoding data.
class DataError < Exception; end
# The +Data+ class provides an interface for decoding, extracting,
@@ -723,11 +721,11 @@
end
# If the current node is binary, returns its value. Otherwise, it returns
# an empty string ("").
def binary
- Cproton.pn_data_get_binary(@data)
+ Qpid::Proton::BinaryString.new(Cproton.pn_data_get_binary(@data))
end
# Puts a unicode string value.
#
# *NOTE:* A nil value is stored as an empty string rather than as a nil.
@@ -740,10 +738,10 @@
end
# If the current node is a string, returns its value. Otherwise, it
# returns an empty string ("").
def string
- Cproton.pn_data_get_string(@data)
+ Qpid::Proton::UTFString.new(Cproton.pn_data_get_string(@data))
end
# Puts a symbolic value.
#
# ==== Options