Class: Arachni::RPC::Client::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/arachni/rpc/client/dispatcher.rb

Overview

RPC Dispatcher client

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts, url) ⇒ Dispatcher

Returns a new instance of Dispatcher.



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/arachni/rpc/client/dispatcher.rb', line 33

def initialize( opts, url )
    @client = Base.new( opts, url )
    @node = RemoteObjectMapper.new( @client, 'node' )

    # map Dispatcher handlers
    Dir.glob( "#{Options.dir['rpcd_handlers']}*.rb" ).each do |handler|
        name = File.basename( handler, '.rb' )

        self.class.send( :attr_reader, name.to_sym )
        instance_variable_set( "@#{name}".to_sym, RemoteObjectMapper.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



55
56
57
# File 'lib/arachni/rpc/client/dispatcher.rb', line 55

def method_missing( sym, *args, &block )
    @client.call( "dispatcher.#{sym.to_s}", *args, &block )
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



31
32
33
# File 'lib/arachni/rpc/client/dispatcher.rb', line 31

def node
  @node
end

Instance Method Details

#urlObject



46
47
48
# File 'lib/arachni/rpc/client/dispatcher.rb', line 46

def url
    @client.url
end