Sha256: 0925ac7bed865f3a30ca468a81d7c5ee81f56b2a160df38513454ab538b8b8ef

Contents?: true

Size: 994 Bytes

Versions: 12

Compression:

Stored size: 994 Bytes

Contents

module Vedeu

  # Provides a mechanism to control a running client application via DRb.
  #
  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 [Vedeu::Distributed::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

12 entries across 12 versions & 1 rubygems

Version Path
vedeu-0.5.2 lib/vedeu/distributed/uri.rb
vedeu-0.5.1 lib/vedeu/distributed/uri.rb
vedeu-0.5.0 lib/vedeu/distributed/uri.rb
vedeu-0.4.65 lib/vedeu/distributed/uri.rb
vedeu-0.4.64 lib/vedeu/distributed/uri.rb
vedeu-0.4.63 lib/vedeu/distributed/uri.rb
vedeu-0.4.62 lib/vedeu/distributed/uri.rb
vedeu-0.4.61 lib/vedeu/distributed/uri.rb
vedeu-0.4.60 lib/vedeu/distributed/uri.rb
vedeu-0.4.59 lib/vedeu/distributed/uri.rb
vedeu-0.4.58 lib/vedeu/distributed/uri.rb
vedeu-0.4.57 lib/vedeu/distributed/uri.rb