1 require 'druby2'
 2 
 3 class Foo
 4     attr_reader :i
 5     def initialize
 6         @i = 0
 7     end
 8     def foo(i)
 9         @i = i
10     end
11     def bar()
12         return @i
13     end
14     def each()
15         yield 1
16         yield 2
17         yield 3
18     end
19     def throw_exception()
20         raise RuntimeError
21     end
22 end
23 
24 obj = Foo.new
25 server = DRuby::Server.new('localhost', '4242')
26 server.register(obj, "foo")
27 server.thread.join