Sha256: 1128d11adb738d11288d222282e8f2ed825b18eca012876c2910cb2d31757184

Contents?: true

Size: 856 Bytes

Versions: 6

Compression:

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

6 entries across 6 versions & 1 rubygems

Version Path
vedeu-0.4.24 lib/vedeu/distributed/uri.rb
vedeu-0.4.23 lib/vedeu/distributed/uri.rb
vedeu-0.4.22 lib/vedeu/distributed/uri.rb
vedeu-0.4.21 lib/vedeu/distributed/uri.rb
vedeu-0.4.20 lib/vedeu/distributed/uri.rb
vedeu-0.4.19 lib/vedeu/distributed/uri.rb