Class: Cuboid::RPC::Client::Agent
- Defined in:
- lib/cuboid/rpc/client/agent.rb
Overview
RPC Agent client
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#pid ⇒ Object
Not always available, set by the parent.
Instance Method Summary collapse
- #address ⇒ Object
- #close ⇒ Object
-
#initialize(url, options = nil) ⇒ Agent
constructor
A new instance of Agent.
- #port ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(url, options = nil) ⇒ Agent
Returns a new instance of Agent.
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/cuboid/rpc/client/agent.rb', line 17 def initialize( url, = nil ) @client = Base.new( url, nil, ) @node = Toq::Proxy.new( @client, 'node' ) Cuboid::Application.application.agent_services.keys.each do |name| self.class.send( :attr_reader, name.to_sym ) instance_variable_set( "@#{name}".to_sym, Toq::Proxy.new( @client, name ) ) end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object (private)
Used to provide the illusion of locality for remote methods
50 51 52 |
# File 'lib/cuboid/rpc/client/agent.rb', line 50 def method_missing( sym, *args, &block ) @client.call( "agent.#{sym.to_s}", *args, &block ) end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
15 16 17 |
# File 'lib/cuboid/rpc/client/agent.rb', line 15 def node @node end |
#pid ⇒ Object
Not always available, set by the parent.
13 14 15 |
# File 'lib/cuboid/rpc/client/agent.rb', line 13 def pid @pid end |
Instance Method Details
#address ⇒ Object
35 36 37 |
# File 'lib/cuboid/rpc/client/agent.rb', line 35 def address @client.address end |
#close ⇒ Object
43 44 45 |
# File 'lib/cuboid/rpc/client/agent.rb', line 43 def close @client.close end |
#port ⇒ Object
39 40 41 |
# File 'lib/cuboid/rpc/client/agent.rb', line 39 def port @client.port end |
#url ⇒ Object
31 32 33 |
# File 'lib/cuboid/rpc/client/agent.rb', line 31 def url @client.url end |