Class: Dizby::ObjectProxy
- Inherits:
-
Object
- Object
- Dizby::ObjectProxy
- Defined in:
- lib/dizby/distributed/proxy.rb
Instance Method Summary collapse
-
#initialize(conn, ref = nil) ⇒ ObjectProxy
constructor
A new instance of ObjectProxy.
- #method_missing(msg_id, *args, &block)
- #respond_to?(msg_id, priv = false) ⇒ Boolean
Constructor Details
#initialize(conn, ref = nil) ⇒ ObjectProxy
Returns a new instance of ObjectProxy.
8 9 10 11 |
# File 'lib/dizby/distributed/proxy.rb', line 8 def initialize(conn, ref = nil) @ref = ref @conn = conn end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(msg_id, *args, &block)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dizby/distributed/proxy.rb', line 13 def method_missing(msg_id, *args, &block) @conn.server.log.debug("calling through proxy: #{msg_id} #{args}") @conn.send_request(@ref, msg_id, *args, &block) succ, result = @conn.recv_reply if succ result elsif result.is_a?(UnknownObject) fail result else bt = Dizby.proxy_backtrace(@conn.remote_uri, result) result.set_backtrace(bt + caller) fail result end end |
Instance Method Details
#respond_to?(msg_id, priv = false) ⇒ Boolean
32 33 34 |
# File 'lib/dizby/distributed/proxy.rb', line 32 def respond_to?(msg_id, priv = false) method_missing(:respond_to?, msg_id, priv) end |