Class: Rubarb::ClientProxy
- Inherits:
-
Object
- Object
- Rubarb::ClientProxy
show all
- Defined in:
- lib/rubarb/server.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(outgoing_connection) ⇒ ClientProxy
Returns a new instance of ClientProxy.
13
14
15
|
# File 'lib/rubarb/server.rb', line 13
def initialize(outgoing_connection)
@remote_connection = outgoing_connection
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/rubarb/server.rb', line 17
def method_missing(method, * args, & block)
EventMachine::schedule do
begin
@remote_connection.remote_call(method, args, & block)
rescue Exception => e
@remote_connection.call_errbacks(e)
end
end
end
|
Instance Attribute Details
#remote_connection ⇒ Object
Returns the value of attribute remote_connection.
11
12
13
|
# File 'lib/rubarb/server.rb', line 11
def remote_connection
@remote_connection
end
|
Instance Method Details
#conn_id ⇒ Object
31
32
33
|
# File 'lib/rubarb/server.rb', line 31
def conn_id
@remote_connection.conn_id
end
|
#errback(&block) ⇒ Object
27
28
29
|
# File 'lib/rubarb/server.rb', line 27
def errback(& block)
@remote_connection.errbacks << block if block
end
|
#stop ⇒ Object
35
36
37
38
39
|
# File 'lib/rubarb/server.rb', line 35
def stop
EventMachine::next_tick do
@remote_connection.close_connection_after_writing
end if @remote_connection
end
|