Sha256: 60b7f260a803bde665a09caa23fc070ef573a1f33366baf6f7db03ae10bc867c

Contents?: true

Size: 860 Bytes

Versions: 4

Compression:

Stored size: 860 Bytes

Contents

module Vedeu

  module Distributed

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

      # @!attribute [r] host
      # @return [String]
      attr_reader :host

      # @!attribute [r] port
      # @return [Fixnum|String]
      attr_reader :port

      # Returns a new instance of Vedeu::Distributed::Uri.
      #
      # @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
        ['druby://', host, ':', port].join
      end

    end # Uri

  end # Distributed

end # Vedeu

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.4.13 lib/vedeu/distributed/uri.rb
vedeu-0.4.12 lib/vedeu/distributed/uri.rb
vedeu-0.4.11 lib/vedeu/distributed/uri.rb
vedeu-0.4.10 lib/vedeu/distributed/uri.rb