Sha256: 639ed6a262b4a14f4b1598203aa7817d28c5990d87687e17809a21236e4ed6e3

Contents?: true

Size: 1.24 KB

Versions: 7

Compression:

Stored size: 1.24 KB

Contents

=begin
    Copyright 2010-2014 Tasos Laskos <tasos.laskos@arachni-scanner.com>

    This file is part of the Arachni Framework project and is subject to
    redistribution and commercial restrictions. Please see the Arachni Framework
    web site for more information on licensing and terms of use.
=end

module Arachni

require Options.paths.lib + 'rpc/client/base'

module RPC
class Client

# RPC Dispatcher client
#
# @author Tasos "Zapotek" Laskos <tasos.laskos@arachni-scanner.com>
class Dispatcher

    attr_reader :node

    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

    def url
        @client.url
    end

    def close
        @client.close
    end

    private

    # Used to provide the illusion of locality for remote methods
    def method_missing( sym, *args, &block )
        @client.call( "dispatcher.#{sym.to_s}", *args, &block )
    end

end

end
end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
arachni-1.0.6 lib/arachni/rpc/client/dispatcher.rb
arachni-1.0.5 lib/arachni/rpc/client/dispatcher.rb
arachni-1.0.4 lib/arachni/rpc/client/dispatcher.rb
arachni-1.0.3 lib/arachni/rpc/client/dispatcher.rb
arachni-1.0.2 lib/arachni/rpc/client/dispatcher.rb
arachni-1.0.1 lib/arachni/rpc/client/dispatcher.rb
arachni-1.0 lib/arachni/rpc/client/dispatcher.rb