Sha256: b2e155dae0adcf924ca4163e73b2ef7dac0fbe3aec102e9f4b72d9731c3565ef

Contents?: true

Size: 1.21 KB

Versions: 10

Compression:

Stored size: 1.21 KB

Contents

require 'ostruct'
require 'arachni/rpc'
require_relative '../serializer'

module Cuboid
module RPC
class Server

# RPC server class
#
# @private
# @author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
class Base < Arachni::RPC::Server

    # @param    [Hash]   options
    # @option options [Integer]  :host
    # @option options [Integer]  :port
    # @option options [Integer]  :socket
    # @option options [Integer]  :ssl_ca
    # @option options [Integer]  :ssl_pkey
    # @option options [Integer]  :ssl_cert
    # @param    [String]    token
    #   Optional authentication token.
    def initialize( options = nil, token = nil )

        # If given nil use the global defaults.
        options ||= Options.rpc.to_server_options
        @options = options

        super(options.merge(
            serializer: Serializer,
            token:      token
        ))
    end

    def address
        @options[:external_address] || @options[:host]
    end

    def port
        @options[:port]
    end

    def url
        return @options[:socket] if @options[:socket]

        "#{address}:#{port}"
    end

    def start
        super
        @ready = true
    end

    def ready?
        @ready ||= false
    end

end

end
end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cuboid-0.1.3 lib/cuboid/rpc/server/base.rb
cuboid-0.1.2 lib/cuboid/rpc/server/base.rb
cuboid-0.1.1 lib/cuboid/rpc/server/base.rb
cuboid-0.1.0 lib/cuboid/rpc/server/base.rb
cuboid-0.0.5 lib/cuboid/rpc/server/base.rb
cuboid-0.0.4 lib/cuboid/rpc/server/base.rb
cuboid-0.0.3 lib/cuboid/rpc/server/base.rb
cuboid-0.0.3alpha lib/cuboid/rpc/server/base.rb
cuboid-0.0.2alpha lib/cuboid/rpc/server/base.rb
cuboid-0.0.1alpha lib/cuboid/rpc/server/base.rb