Class: Arachni::RPC::Client::Dispatcher
- Defined in:
- lib/arachni/rpc/client/dispatcher.rb
Overview
RPC Dispatcher client
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(opts, url) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
- #url ⇒ Object
Constructor Details
#initialize(opts, url) ⇒ Dispatcher
Returns a new instance of Dispatcher.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/arachni/rpc/client/dispatcher.rb', line 23 def initialize( opts, url ) @client = Base.new( opts, url ) @node = Proxy.new( @client, 'node' ) # map Dispatcher handlers Dir.glob( "#{Options.paths.services}*.rb" ).each do |handler| name = File.basename( handler, '.rb' ) self.class.send( :attr_reader, name.to_sym ) instance_variable_set( "@#{name}".to_sym, 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
47 48 49 |
# File 'lib/arachni/rpc/client/dispatcher.rb', line 47 def method_missing( sym, *args, &block ) @client.call( "dispatcher.#{sym.to_s}", *args, &block ) end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
21 22 23 |
# File 'lib/arachni/rpc/client/dispatcher.rb', line 21 def node @node end |