Fix up Rubinius specific library specs.
[rbx.git] / lib / drb / invokemethod.rb
blob7da8ace88df1f05a3d71bb103c73399309580a7a
1 # for ruby-1.8.0
3 module DRb
4   class DRbServer
5     module InvokeMethod18Mixin
6       def block_yield(x)
7         if x.size == 1 && x[0].class == Array
8           x[0] = DRbArray.new(x[0])
9         end
10         block_value = @block.call(*x)
11       end
12       
13       def perform_with_block
14         @obj.__send__(@msg_id, *@argv) do |*x|
15           jump_error = nil
16           begin
17             block_value = block_yield(x)
18           rescue LocalJumpError
19             jump_error = $!
20           end
21           if jump_error
22             case jump_error.reason
23             when :break
24               break(jump_error.exit_value)
25             else
26               raise jump_error
27             end
28           end
29           block_value
30         end
31       end
32     end
33   end
34 end