Class: Zoidberg::SoftShell::AsyncProxy
- Inherits:
-
Object
- Object
- Zoidberg::SoftShell::AsyncProxy
- Defined in:
- lib/zoidberg/shell.rb
Instance Attribute Summary collapse
-
#locked ⇒ Object
readonly
Returns the value of attribute locked.
-
#origin_proxy ⇒ Object
readonly
Returns the value of attribute origin_proxy.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(locked_async, proxy) ⇒ AsyncProxy
constructor
A new instance of AsyncProxy.
- #method_missing(*args, &block) ⇒ Object
Constructor Details
#initialize(locked_async, proxy) ⇒ AsyncProxy
Returns a new instance of AsyncProxy.
34 35 36 37 38 |
# File 'lib/zoidberg/shell.rb', line 34 def initialize(locked_async, proxy) @locked = locked_async @origin_proxy = proxy @target = proxy._raw_instance end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/zoidberg/shell.rb', line 39 def method_missing(*args, &block) target._zoidberg_thread( Thread.new{ origin_proxy._aquire_lock! if locked got_lock = locked begin target.send(*args, &block) rescue Zoidberg::DeadException => e if(e.origin_object_id == target.object_id) got_lock = false end raise rescue StandardError, ScriptError => e origin_proxy._zoidberg_unexpected_error(e) raise ensure origin_proxy._release_lock! if got_lock end } ) nil end |
Instance Attribute Details
#locked ⇒ Object (readonly)
Returns the value of attribute locked.
31 32 33 |
# File 'lib/zoidberg/shell.rb', line 31 def locked @locked end |
#origin_proxy ⇒ Object (readonly)
Returns the value of attribute origin_proxy.
33 34 35 |
# File 'lib/zoidberg/shell.rb', line 33 def origin_proxy @origin_proxy end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
32 33 34 |
# File 'lib/zoidberg/shell.rb', line 32 def target @target end |