Sha256: f80add83513c9a91858bc64d79daaa8a264d071f1857d1b7cf833d42dfcd6cf6

Contents?: true

Size: 743 Bytes

Versions: 5

Compression:

Stored size: 743 Bytes

Contents

module Vedeu

  module Distributed

    # Value class which provides the host and port for the DRb server and
    # client.
    #
    class Uri

      attr_reader :host, :port

      # @param host [String] Hostname or IP address.
      # @param port [Fixnum|String]
      # @return [Uri]
      def initialize(host = 'localhost', port = 21420)
        @host = host || 'localhost'
        @port = port || 21420
      end

      # @example
      #   'druby://localhost:21420'
      #
      # @return [String] The host and port as a single value.
      def to_s
        [scheme, host, ':', port].join
      end

      private

      # @return [String]
      def scheme
        'druby://'
      end

    end # Uri

  end # Distributed

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.4.3 lib/vedeu/distributed/uri.rb
vedeu-0.4.2 lib/vedeu/distributed/uri.rb
vedeu-0.4.1 lib/vedeu/distributed/uri.rb
vedeu-0.4.0 lib/vedeu/distributed/uri.rb
vedeu-0.3.5 lib/vedeu/distributed/uri.rb