Class: Zoidberg::SoftShell::AsyncProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/zoidberg/shell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ AsyncProxy

Returns a new instance of AsyncProxy.



13
14
15
# File 'lib/zoidberg/shell.rb', line 13

def initialize(instance)
  @target = instance
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/zoidberg/shell.rb', line 16

def method_missing(*args, &block)
  target._zoidberg_thread(
    Thread.new{
      begin
        target.send(*args, &block)
      rescue Exception => e
        target._zoidberg_proxy.send(:raise, e)
      end
    }
  )
  nil
end

Instance Attribute Details

#targetObject (readonly)

Returns the value of attribute target.



12
13
14
# File 'lib/zoidberg/shell.rb', line 12

def target
  @target
end