Sha256: 31a0ed0722b5fbf8213f0da7ae4abaeea69f7273a908f48ce1f7ea9b8ec58718

Contents?: true

Size: 1.01 KB

Versions: 9

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

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.
    #
    # @api private
    #
    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}"
      end
      alias to_str to_s

    end # Uri

  end # Distributed

end # Vedeu

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.8.32 lib/vedeu/distributed/uri.rb
vedeu-0.8.31 lib/vedeu/distributed/uri.rb
vedeu-0.8.30 lib/vedeu/distributed/uri.rb
vedeu-0.8.29 lib/vedeu/distributed/uri.rb
vedeu-0.8.28 lib/vedeu/distributed/uri.rb
vedeu-0.8.27 lib/vedeu/distributed/uri.rb
vedeu-0.8.26 lib/vedeu/distributed/uri.rb
vedeu-0.8.25 lib/vedeu/distributed/uri.rb
vedeu-0.8.24 lib/vedeu/distributed/uri.rb