Class: RobotArmy::Proxy
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(messenger, hash) ⇒ Proxy
constructor
A new instance of Proxy.
Constructor Details
#initialize(messenger, hash) ⇒ Proxy
Returns a new instance of Proxy.
5 6 7 8 |
# File 'lib/robot-army/proxy.rb', line 5 def initialize(messenger, hash) @messenger = messenger @hash = hash end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args, &block) ⇒ Object (private)
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/robot-army/proxy.rb', line 16 def method_missing(*args, &block) @messenger.post(:status => 'proxy', :data => {:hash => @hash, :call => args}) response = @messenger.get case response[:status] when 'proxy' return RobotArmy::Proxy.new(@messenger, response[:data]) else return RobotArmy::Connection.handle_response(response) end end |
Class Method Details
.generator_for(object) ⇒ Object
10 11 12 |
# File 'lib/robot-army/proxy.rb', line 10 def self.generator_for(object) "RobotArmy::Proxy.new(RobotArmy.upstream, #{object.hash.inspect})" end |