You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2017/12/06 15:59:45 UTC

[3/6] qpid-proton git commit: PROTON-1537: [ruby] Wrapper hash/equality @impl pointer

PROTON-1537: [ruby] Wrapper hash/equality @impl pointer

Override hash/equality on ruby wrappers for proton objects to be based on the
pn_x pointer rather than the ruby object identity - wrappers are equivalent if
they wrap the same pn_x object, including when used as Hash 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/56b0949f
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/56b0949f
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/56b0949f

Branch: refs/heads/master
Commit: 56b0949faa64fc212ef93647155f892849deb681
Parents: e044523
Author: Alan Conway <ac...@redhat.com>
Authored: Tue Dec 5 10:45:47 2017 -0500
Committer: Alan Conway <ac...@redhat.com>
Committed: Tue Dec 5 16:54:45 2017 -0500

----------------------------------------------------------------------
 proton-c/bindings/ruby/lib/util/wrapper.rb | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/56b0949f/proton-c/bindings/ruby/lib/util/wrapper.rb
----------------------------------------------------------------------
diff --git a/proton-c/bindings/ruby/lib/util/wrapper.rb b/proton-c/bindings/ruby/lib/util/wrapper.rb
index 8db1c4e..8537e4b 100644
--- a/proton-c/bindings/ruby/lib/util/wrapper.rb
+++ b/proton-c/bindings/ruby/lib/util/wrapper.rb
@@ -116,6 +116,12 @@ module Qpid::Proton::Util
 
     end
 
+    # Hash/equality of wrappers is based on their @impl pointers, not object_id
+
+    def hash() @impl.hash; end
+    def ==(x)  @impl == x.impl; end
+    alias eql? ==
+
   end
 
   # @private


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org