summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/RubyUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/RubyUtil.cpp')
-rw-r--r--cpp/src/Slice/RubyUtil.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp
index f20568064c0..b9a2ddbc3ce 100644
--- a/cpp/src/Slice/RubyUtil.cpp
+++ b/cpp/src/Slice/RubyUtil.cpp
@@ -191,7 +191,16 @@ Slice::Ruby::CodeVisitor::CodeVisitor(Output& out) :
bool
Slice::Ruby::CodeVisitor::visitModuleStart(const ModulePtr& p)
{
- _out << sp << nl << "module " << fixIdent(p->name(), IdentToUpper);
+ _out << sp << nl << "module ";
+ //
+ // Ensure that Slice top-level modules are defined as top
+ // level modules in Ruby
+ //
+ if(UnitPtr::dynamicCast(p->container()))
+ {
+ _out << "::";
+ }
+ _out << fixIdent(p->name(), IdentToUpper);
_out.inc();
return true;
}