Class: IRC::Commands::PongCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/irc/commands/pong_command.rb

Overview

4.6.3 Pong message

Command: PONG Parameters: <daemon> [<daemon2>]

PONG message is a reply to ping message. If parameter <daemon2> is given this message must be forwarded to given daemon. The <daemon> parameter is the name of the daemon who has responded to PING message and generated this message.

Numeric Replies:

  • ERR_NOORIGIN

* ERR_NOSUCHSERVER

Examples:

PONG csd.bu.edu tolsun.oulu.fi ; PONG message from csd.bu.edu to

Instance Attribute Summary collapse

Attributes inherited from Command

#response

Instance Method Summary collapse

Methods inherited from Command

#execute, #on_server_response, #to_s, #valid_response?, #wait

Methods included from IRC::Client::ConnectionListener

#on_connect, #on_disconnect, #on_error, #on_join, #on_join_failure, #on_kick, #on_nick, #on_nick_already_in_use, #on_notice, #on_part, #on_part_failure, #on_ping, #on_pong, #on_private_message, #on_registration, #on_registration_failure, #on_server_response, #on_welcome

Constructor Details

#initialize(first_daemon, second_daemon = nil) ⇒ PongCommand

Returns a new instance of PongCommand.

Raises:



55
56
57
58
59
60
61
# File 'lib/irc/commands/pong_command.rb', line 55

def initialize(first_daemon, second_daemon = nil)

  raise InvalidCommand.new("Can't create ping command. No daemon.") unless first_daemon
  @first_daemon, @second_daemon = first_daemon, second_daemon
  super(command)              
  
end

Instance Attribute Details

#first_daemonObject (readonly)

Returns the value of attribute first_daemon.



52
53
54
# File 'lib/irc/commands/pong_command.rb', line 52

def first_daemon
  @first_daemon
end

#second_daemonObject (readonly)

Returns the value of attribute second_daemon.



53
54
55
# File 'lib/irc/commands/pong_command.rb', line 53

def second_daemon
  @second_daemon
end

Instance Method Details

#commandObject



63
64
65
# File 'lib/irc/commands/pong_command.rb', line 63

def command
  return "PONG #{first_daemon} #{second_daemon != nil ? second_daemon.to_s : ''}".strip
end