Sha256: 5c8ba7b7b2dac9df155ee5c3a99e6a244e8045a41bcfc3e99ef71bcf80ee766d

Contents?: true

Size: 862 Bytes

Versions: 5

Compression:

Stored size: 862 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 = 21_420)
        @host = host || 'localhost'
        @port = port || 21_420
      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

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.4.18 lib/vedeu/distributed/uri.rb
vedeu-0.4.17 lib/vedeu/distributed/uri.rb
vedeu-0.4.16 lib/vedeu/distributed/uri.rb
vedeu-0.4.15 lib/vedeu/distributed/uri.rb
vedeu-0.4.14 lib/vedeu/distributed/uri.rb