Lots of Ruby code generation improvements
Summary: Submitted by Kevin Clark, Ruby guru from Powerset
Reviewed By: mcslee
Test Plan: He updated the tests in trunk/test/rb/
Notes: The code is now officially "ruby-ish" and idiomatic
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665151 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/rb/TestServer.rb b/test/rb/TestServer.rb
index c0d7b59..892037e 100755
--- a/test/rb/TestServer.rb
+++ b/test/rb/TestServer.rb
@@ -9,8 +9,6 @@
require 'ThriftTest'
class TestHandler
- include ThriftTest::Iface
-
def testVoid()
print "testVoid()\n"
end
@@ -42,6 +40,7 @@
def testStruct(thing)
print "testStruct(#{thing})\n"
+ print " with attrs: #{thing.string_thing}, #{thing.byte_thing}, #{thing.i32_thing}"
return thing
end
@@ -69,11 +68,33 @@
end
return thing
end
+
+ def testNest(thing)
+ print "testNest(#{thing})\n"
+ puts " i32_thing: #{thing.i32_thing}"
+ puts " with struct: "
+ %w{ string_thing byte_thing i32_thing }.each do |t|
+ puts " #{t}: #{thing.struct_thing.send(t)}"
+ end
+ return thing
+ end
+
+ def testInsanity(thing)
+ puts "insanity:"
+ puts " #{thing.inspect}"
+ num, uid = thing.userMap.find { true }
+ return {uid => {num => thing}}
+ end
+
+ def testMapMap(thing)
+ puts "got: #{thing}"
+ return {thing => {thing => thing}}
+ end
end
handler = TestHandler.new()
-processor = ThriftTest::Processor.new(handler)
+processor = Thrift::Test::ThriftTest::Processor.new(handler)
transport = TServerSocket.new(9090)
server = TSimpleServer.new(processor, transport)
server.serve()