Class: Bones::RPC::Synchronous::Connection::Writer::NodeProxy
- Inherits:
-
BasicObject
- Defined in:
- lib/bones/rpc/synchronous/connection/writer.rb
Overview
Instance Method Summary
collapse
Constructor Details
#initialize(node) ⇒ NodeProxy
Returns a new instance of NodeProxy.
66
67
68
69
|
# File 'lib/bones/rpc/synchronous/connection/writer.rb', line 66
def initialize(node)
@node = node
@registry = Node::Registry.new
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
77
78
79
|
# File 'lib/bones/rpc/synchronous/connection/writer.rb', line 77
def method_missing(name, *args, &block)
@node.__send__(name, *args, &block)
end
|
Instance Method Details
#attach(channel, id, future) ⇒ Object
50
51
52
|
# File 'lib/bones/rpc/synchronous/connection/writer.rb', line 50
def attach(channel, id, future)
@registry.set(channel, id, future)
end
|
#detach(channel, id) ⇒ Object
54
55
56
|
# File 'lib/bones/rpc/synchronous/connection/writer.rb', line 54
def detach(channel, id)
@registry.get(channel, id)
end
|
#handle_message(message) ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/bones/rpc/synchronous/connection/writer.rb', line 58
def handle_message(message)
logging(message) do
if future = message.get(self)
message.signal(future)
end
end
end
|
#registry_empty? ⇒ Boolean
71
72
73
|
# File 'lib/bones/rpc/synchronous/connection/writer.rb', line 71
def registry_empty?
@registry.empty?
end
|