Sha256: 4e44f1793971d4dedad723f93c3481fa35f81660b15ae8d9c62bd7a199ac8fc9

Contents?: true

Size: 950 Bytes

Versions: 4

Compression:

Stored size: 950 Bytes

Contents

# Common functionality for Client and Server.
module CarrotRpc::ClientServer
  # @overload queue_name(new_name)
  #   @note Default naming not performed. Class must pass queue name.
  #
  #   Allows for class level definition of queue name.
  #
  #   @param new_name [String] the queue name for the class.
  #   @return [String] `new_name`
  #
  # @overload queue_name
  #   The current queue name previously set with `#queue_name(new_name)`.
  #
  #   @return [String]
  def queue_name(*args)
    if args.length == 0
      @queue_name
    elsif args.length == 1
      @queue_name = args[0]
    else
      fail ArgumentError,
           "queue_name(new_name) :: new_name or queue_name() :: current_name are the only ways to call queue_name"
    end
  end

  def test_queue_name(name, append_name = false)
    return name unless append_name
    if name
      "#{name}_test"
    else
      fail CarrotRpc::Exception::InvalidQueueName
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
carrot_rpc-0.8.0 lib/carrot_rpc/client_server.rb
carrot_rpc-0.7.1 lib/carrot_rpc/client_server.rb
carrot_rpc-0.7.0 lib/carrot_rpc/client_server.rb
carrot_rpc-0.6.0 lib/carrot_rpc/client_server.rb