Sha256: fad8f789591cf03f33d8e4e54a184c541601630ec238c9ce154f2fcf80231b73

Contents?: true

Size: 890 Bytes

Versions: 8

Compression:

Stored size: 890 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
      alias_method :to_str, :to_s

    end # Uri

  end # Distributed

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.4.32 lib/vedeu/distributed/uri.rb
vedeu-0.4.31 lib/vedeu/distributed/uri.rb
vedeu-0.4.30 lib/vedeu/distributed/uri.rb
vedeu-0.4.29 lib/vedeu/distributed/uri.rb
vedeu-0.4.28 lib/vedeu/distributed/uri.rb
vedeu-0.4.27 lib/vedeu/distributed/uri.rb
vedeu-0.4.26 lib/vedeu/distributed/uri.rb
vedeu-0.4.25 lib/vedeu/distributed/uri.rb