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
Constructor Details
#initialize(args) ⇒ Proxy_obj
412
413
414
415
416
|
# File 'lib/knj/process_meta.rb', line 412
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.
419
420
421
422
423
424
425
426
427
428
429
430
|
# File 'lib/knj/process_meta.rb', line 419
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
457
458
459
460
461
462
|
# File 'lib/knj/process_meta.rb', line 457
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
444
445
446
447
448
449
450
451
452
453
454
455
|
# File 'lib/knj/process_meta.rb', line 444
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
|
436
437
438
|
# File 'lib/knj/process_meta.rb', line 436
def _process_meta_args
return @args
end
|
440
441
442
|
# File 'lib/knj/process_meta.rb', line 440
def _process_meta_block_buffer_use=(newval)
@_process_meta_block_buffer_use = newval
end
|
432
433
434
|
# File 'lib/knj/process_meta.rb', line 432
def _process_meta_unset
@args[:process_meta].process.send("obj" => {"type" => "unset", "var_name" => @args[:name]})
end
|