Class: Knj::Process_meta::Proxy_obj
Overview
This proxies all events to the sub-process.
Defined Under Namespace
Classes: Buffered_caller
Instance Method Summary collapse
- #_pm_buffered_caller(args) ⇒ Object
- #_pm_send_noret(method_name, *args, &block) ⇒ Object
- #_process_meta_args ⇒ Object
- #_process_meta_block_buffer_use=(newval) ⇒ Object
- #_process_meta_unset ⇒ Object
-
#initialize(args) ⇒ Proxy_obj
constructor
A new instance of Proxy_obj.
-
#method_missing(method_name, *args, &block) ⇒ Object
This proxies all method-calls through the process-handeler and returns the result as the object was precent inside the current process-memory, even though it is not.
Constructor Details
#initialize(args) ⇒ Proxy_obj
Returns a new instance of Proxy_obj.
411 412 413 414 415 |
# File 'lib/knj/process_meta.rb', line 411 def initialize(args) @args = args @_process_meta_block_buffer_use = false ObjectSpace.define_finalizer(self, @args[:process_meta].method(:proxy_finalizer)) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
This proxies all method-calls through the process-handeler and returns the result as the object was precent inside the current process-memory, even though it is not.
418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/knj/process_meta.rb', line 418 def method_missing(method_name, *args, &block) raise "No arguments on the object?" if !@args @args[:process_meta].call_object( { "var_name" => @args[:name], "method_name" => method_name, "args" => args, "buffer_use" => @_process_meta_block_buffer_use }, &block ) end |
Instance Method Details
#_pm_buffered_caller(args) ⇒ Object
456 457 458 459 460 461 |
# File 'lib/knj/process_meta.rb', line 456 def _pm_buffered_caller(args) return Knj::Process_meta::Proxy_obj::Buffered_caller.new({ :name => @args[:name], :process_meta => @args[:process_meta] }.merge(args)) end |
#_pm_send_noret(method_name, *args, &block) ⇒ Object
443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/knj/process_meta.rb', line 443 def _pm_send_noret(method_name, *args, &block) @args[:process_meta].call_object( { "var_name" => @args[:name], "method_name" => method_name, "args" => args, "buffer_use" => @_process_meta_block_buffer_use, "capture_return" => false }, &block ) end |
#_process_meta_args ⇒ Object
435 436 437 |
# File 'lib/knj/process_meta.rb', line 435 def return @args end |
#_process_meta_block_buffer_use=(newval) ⇒ Object
439 440 441 |
# File 'lib/knj/process_meta.rb', line 439 def (newval) @_process_meta_block_buffer_use = newval end |
#_process_meta_unset ⇒ Object
431 432 433 |
# File 'lib/knj/process_meta.rb', line 431 def @args[:process_meta].process.send("obj" => {"type" => "unset", "var_name" => @args[:name]}) end |