Class | Breakpoint::CommandBundle::Client |
In: |
lib/breakpoint.rb
|
Parent: | Object |
Proxy to a Breakpoint client. Lets you directly execute code in the context of the client.
Executes the specified code at the client.
# File lib/breakpoint.rb, line 143 143: def eval(code) 144: @eval_handler.call(code) 145: end
Will execute the specified statement at the client.
# File lib/breakpoint.rb, line 148 148: def method_missing(method, *args, &block) 149: if args.empty? and not block 150: result = eval "#{method}" 151: else 152: # This is a bit ugly. The alternative would be using an 153: # eval context instead of an eval handler for executing 154: # the code at the client. The problem with that approach 155: # is that we would have to handle special expressions 156: # like "self", "nil" or constants ourself which is hard. 157: remote = eval %{ 158: result = lambda { |block, *args| #{method}(*args, &block) } 159: def result.call_with_block(*args, &block) 160: call(block, *args) 161: end 162: result 163: } 164: remote.call_with_block(*args, &block) 165: end 166: 167: return result 168: end