Sha256: ce875c45edf7ced91ed9ddd19f3e818cae83b7c101b0e748602aa2413c70cc55

Contents?: true

Size: 737 Bytes

Versions: 1

Compression:

Stored size: 737 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

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.3.4 lib/vedeu/distributed/uri.rb