summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Clark <kclark@apache.org>2009-01-05 23:00:22 +0000
committerKevin Clark <kclark@apache.org>2009-01-05 23:00:22 +0000
commitbcb4cf83e56ecbe5167d8c6ae79248c35020afe4 (patch)
treee37266af7c256d1c50d2cb69f9cc5870e5cccf1b
parent8eaebfedc12bfc95ba3069bf99fe73375b1f8152 (diff)
downloadthrift-bcb4cf83e56ecbe5167d8c6ae79248c35020afe4.tar.gz
THRFIT-231. rb: Make Thrift::Structs hashable
Author: Bryan Duxbury git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@731760 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--lib/rb/lib/thrift/struct.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/rb/lib/thrift/struct.rb b/lib/rb/lib/thrift/struct.rb
index 4b9916807..25eb98191 100644
--- a/lib/rb/lib/thrift/struct.rb
+++ b/lib/rb/lib/thrift/struct.rb
@@ -129,6 +129,15 @@ module Thrift
true
end
+ def eql?(other)
+ self.class == other.class && self == other
+ end
+
+ # for the time being, we're ok with a naive hash. this could definitely be improved upon.
+ def hash
+ 0
+ end
+
def self.field_accessor(klass, *fields)
fields.each do |field|
klass.send :attr_reader, field