summaryrefslogtreecommitdiff
path: root/tutorial/rb
diff options
context:
space:
mode:
authorChristopher Piro <cpiro@apache.org>2007-07-25 22:41:00 +0000
committerChristopher Piro <cpiro@apache.org>2007-07-25 22:41:00 +0000
commit5f5fdf3a20f2459eabbee771e6eff4159c6f2bca (patch)
treeeadf7c0b3852cb33956848a91f1913a8d11e921e /tutorial/rb
parentff8eb9288d57845319b65f1bfd3d4a13cecc3217 (diff)
downloadthrift-5f5fdf3a20f2459eabbee771e6eff4159c6f2bca.tar.gz
[thrift] maps, lists, sets, and service inheritance for Erlang
Reviewed by: cpiro Test Plan: tested wit tutorial/tutorial.thrift Revert Plan: ok git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665175 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tutorial/rb')
-rwxr-xr-xtutorial/rb/RubyClient.rb43
1 files changed, 25 insertions, 18 deletions
diff --git a/tutorial/rb/RubyClient.rb b/tutorial/rb/RubyClient.rb
index bcf130094..9ee6e7942 100755
--- a/tutorial/rb/RubyClient.rb
+++ b/tutorial/rb/RubyClient.rb
@@ -2,27 +2,40 @@
$:.push('../gen-rb')
-require 'thrift/transport/tsocket'
-require 'thrift/protocol/tbinaryprotocol'
+require 'thrift/transport/tsocket.rb'
+require 'thrift/protocol/tbinaryprotocol.rb'
require 'Calculator'
begin
+ port = ARGV[0] || 9090
- transport = TBufferedTransport.new(TSocket.new('localhost', 9090))
+ transport = TBufferedTransport.new(TSocket.new('localhost', port))
protocol = TBinaryProtocol.new(transport)
client = Calculator::Client.new(protocol)
-
+
transport.open()
-
+
client.ping()
print "ping()\n"
-
+
sum = client.add(1,1)
print "1+1=", sum, "\n"
-
+
+ sum = client.add(1,4)
+ print "1+4=", sum, "\n"
+
work = Work.new()
-
+
+ work.op = Operation::SUBTRACT
+ work.num1 = 15
+ work.num2 = 10
+ diff = client.calculate(1, work)
+ print "15-10=", diff, "\n"
+
+ log = client.getStruct(1)
+ print "Log: ", log.value, "\n"
+
begin
work.op = Operation::DIVIDE
work.num1 = 1
@@ -32,16 +45,10 @@ begin
rescue InvalidOperation => io
print "InvalidOperation: ", io.why, "\n"
end
-
- work.op = Operation::SUBTRACT
- work.num1 = 15
- work.num2 = 10
- diff = client.calculate(1, work)
- print "15-10=", diff, "\n"
-
- log = client.getStruct(1)
- print "Log: ", log.value, "\n"
-
+
+ client.zip()
+ print "zip\n"
+
transport.close()
rescue TException => tx