qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [3/6] qpid-proton git commit: PROTON-1537: [ruby] Wrapper hash/equality @impl pointer
Date Wed, 06 Dec 2017 15:59:45 GMT
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 <aconway@redhat.com>
Authored: Tue Dec 5 10:45:47 2017 -0500
Committer: Alan Conway <aconway@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


Mime
View raw message