Class: Breakpoint::CommandBundle::Client
- Defined in:
- lib/active_record/support/breakpoint.rb
Overview
Proxy to a Breakpoint client. Lets you directly execute code in the context of the client.
Instance Method Summary collapse
-
#eval(code) ⇒ Object
Executes the specified code at the client.
-
#initialize(eval_handler) ⇒ Client
constructor
:nodoc:.
-
#method_missing(method, *args) ⇒ Object
Will execute the specified statement at the client.
Constructor Details
#initialize(eval_handler) ⇒ Client
:nodoc:
121 122 123 |
# File 'lib/active_record/support/breakpoint.rb', line 121 def initialize(eval_handler) # :nodoc: @eval_handler = eval_handler end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
Will execute the specified statement at the client.
136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/active_record/support/breakpoint.rb', line 136 def method_missing(method, *args) if args.empty? result = eval("#{method}") else result = eval("#{method}(*Marshal.load(#{Marshal.dump(args).inspect}))") end unless [true, false, nil].include?(result) result.extend(DRbUndumped) if result end return result end |
Instance Method Details
#eval(code) ⇒ Object
Executes the specified code at the client.
131 132 133 |
# File 'lib/active_record/support/breakpoint.rb', line 131 def eval(code) @eval_handler.call(code) end |