Author: kclark
Date: Mon Jan 5 15:00:22 2009
New Revision: 731760
URL: http://svn.apache.org/viewvc?rev=731760&view=rev
Log:
THRFIT-231. rb: Make Thrift::Structs hashable
Author: Bryan Duxbury
Modified:
incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb
Modified: incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb
URL:
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb?rev=731760&r1=731759&r2=731760&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb (original)
+++ incubator/thrift/trunk/lib/rb/lib/thrift/struct.rb Mon Jan 5 15:00:22 2009
@@ -129,6 +129,15 @@
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