PROTON:1789: [ruby] `pre_encode': undefined method `symbol_keys!'
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/c230552c Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/c230552c Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/c230552c Branch: refs/heads/master Commit: c230552cda7c424ef8815f08d58398bdf429bf1e Parents: de8df02 Author: Alan Conway <[email protected]> Authored: Tue Mar 20 17:43:04 2018 -0400 Committer: Alan Conway <[email protected]> Committed: Wed Mar 21 09:13:14 2018 -0400 ---------------------------------------------------------------------- proton-c/bindings/ruby/lib/types/hash.rb | 6 ++++++ proton-c/bindings/ruby/tests/test_container.rb | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c230552c/proton-c/bindings/ruby/lib/types/hash.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/lib/types/hash.rb b/proton-c/bindings/ruby/lib/types/hash.rb index 2702ab2..70d54bd 100644 --- a/proton-c/bindings/ruby/lib/types/hash.rb +++ b/proton-c/bindings/ruby/lib/types/hash.rb @@ -44,6 +44,12 @@ module Qpid::Proton::Types end # @private + def self.symbol_keys!(h) + h.keys.each { |k| h[k.to_sym] = h.delete(k) unless k.is_a? Symbol } if h + h + end + + # @private def self.symbol_array(a) a && UniformArray.new(SYMBOL, a.collect { |v| v.to_sym }) end http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/c230552c/proton-c/bindings/ruby/tests/test_container.rb ---------------------------------------------------------------------- diff --git a/proton-c/bindings/ruby/tests/test_container.rb b/proton-c/bindings/ruby/tests/test_container.rb index b35e24f..a0c32ed 100644 --- a/proton-c/bindings/ruby/tests/test_container.rb +++ b/proton-c/bindings/ruby/tests/test_container.rb @@ -32,20 +32,19 @@ class ContainerTest < MiniTest::Test send_handler = Class.new(ExceptionMessagingHandler) do attr_reader :accepted, :sent - def initialize() @ready = Queue.new; end - def on_sendable(sender) - sender.send Message.new("foo") unless @sent + unless @sent + m = Message.new("hello") + m[:foo] = :bar + sender.send m + end @sent = true end def on_tracker_accept(tracker) @accepted = true tracker.connection.close - @ready << nil end - - def wait() @ready.pop(); end end.new receive_handler = Class.new(ExceptionMessagingHandler) do @@ -69,7 +68,8 @@ class ContainerTest < MiniTest::Test assert send_handler.accepted assert_equal "testlink", receive_handler.link.name - assert_equal "foo", receive_handler.message.body + assert_equal "hello", receive_handler.message.body + assert_equal :bar, receive_handler.message[:foo] assert_equal "test_simple", receive_handler.link.connection.container_id end --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
