[thrift] thrift ruby namespaces

Ross McFarland rwmcfa1 at gmail.com
Fri Feb 29 14:34:20 PST 2008


i'm working with a ruby script that hits two thrift services. they
both have a struct Element which is colliding.  to fix this i put in a
namespace for ruby in the thrift defs. that solved the immediate
problem, but turned up two other minor ones.

it doesn't look like  "namespace ruby NAMESPACE" works and i still
have to do "ruby_namespace NAMESPACE" and no warning message is
printed like for the others.

once i added ruby_namespace things were a little off. there's now two
module lines in the service .rb file. and the indention is off in all
3 of the generated files.

i've attached a patch that fixes the extra modules, but i haven't
tried to straighten out the indent stuff as what i'm seeing there
doesn't make sense with respect to the code.

this will stop putting a module around the service def when no
namespace is provided for ruby in the thrift def which will match the
behavior i've seen in other languages. this also makes all 3 files
behave the same. without this patch you can't use a namespace and thus
any two services with objects sharing names.

-rm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ruby_modules_fixes.patch
Type: text/x-patch
Size: 628 bytes
Desc: not available
Url : http://publists.facebook.com/pipermail/thrift/attachments/20080229/0b3bee77/attachment.bin 


More information about the thrift mailing list