Class: BackgroundLite::RunnerHandler
- Defined in:
- lib/background_lite/core_ext/handlers/runner_handler.rb
Overview
This background handler runs the method block via script/runner.
Class Method Summary collapse
-
.execute(object, method, args) ⇒ Object
Executes an encoded message which was sent via command line to runner.
-
.handle(object, method, args, options = {}) ⇒ Object
Marshals the method and arguments and sends them to script/runner.
Class Method Details
.execute(object, method, args) ⇒ Object
Executes an encoded message which was sent via command line to runner
14 15 16 17 18 19 20 |
# File 'lib/background_lite/core_ext/handlers/runner_handler.rb', line 14 def self.execute(object, method, args) object, args = self.decode(object), self.decode(args) puts "--- executing method: #{method}\n--- with variables: #{args.inspect}\n--- in object: #{object.inspect}" object.send(method, *args) puts "--- it happened!" end |
.handle(object, method, args, options = {}) ⇒ Object
Marshals the method and arguments and sends them to script/runner.
7 8 9 10 11 |
# File 'lib/background_lite/core_ext/handlers/runner_handler.rb', line 7 def self.handle(object, method, args, = {}) fork do system(%{script/runner "BackgroundLite::RunnerHandler.execute '#{encode(object)}', '#{method}', '#{encode(args)}'"}) end end |