summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/RubyUtil.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2009-02-05 13:06:12 -0800
committerMark Spruiell <mes@zeroc.com>2009-02-05 13:06:12 -0800
commit329595b8f271926da9b3b27fba74b5fc5e5a3804 (patch)
tree22d052444199a8385972c62aa67a237512cc317e /cpp/src/Slice/RubyUtil.cpp
parentMinor fixes to nrvo README (diff)
downloadice-329595b8f271926da9b3b27fba74b5fc5e5a3804.tar.bz2
ice-329595b8f271926da9b3b27fba74b5fc5e5a3804.tar.xz
ice-329595b8f271926da9b3b27fba74b5fc5e5a3804.zip
bug 3373: struct as dictionary keys not tested
- Reverted changes to operations test in PHP because PHP's native dictionary type (array) does not support objects as keys. - Fixed the Ruby test failure. Ruby's dictionary type (Hash) calls eql? to determine key equality, so the translator now generates this method for structures.
Diffstat (limited to 'cpp/src/Slice/RubyUtil.cpp')
-rw-r--r--cpp/src/Slice/RubyUtil.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp
index 3227446ee82..86869339cab 100644
--- a/cpp/src/Slice/RubyUtil.cpp
+++ b/cpp/src/Slice/RubyUtil.cpp
@@ -1021,6 +1021,17 @@ Slice::Ruby::CodeVisitor::visitStructStart(const StructPtr& p)
_out << nl << "end";
//
+ // eql?
+ //
+ // This method is used to determine the equality of keys in a Hash object.
+ //
+ _out << sp << nl << "def eql?(other)";
+ _out.inc();
+ _out << nl << "return other.class == self.class && other == self";
+ _out.dec();
+ _out << nl << "end";
+
+ //
// inspect
//
_out << sp << nl << "def inspect";