Class: Rubot::Core::Exiter
Overview
Base class for all exiters. An exiter cannot be called directly, but is executed when the server receives the quit message or an interrupt is triggered
Example
This exiter says goodbye to all channels the bot is in.
class Bye < Rubot::Core::Exiter
def execute(server)
server.channels.each do |channel|
server.msg(channel, "bye everybody!")
end
end
end
Instance Method Summary collapse
-
#execute(server) ⇒ Object
Runs the exiter with the given server.
-
#initialize(dispatcher) ⇒ Exiter
constructor
Takes an instance of Rubot::Core::Dispatcher.
Constructor Details
#initialize(dispatcher) ⇒ Exiter
Takes an instance of Rubot::Core::Dispatcher. Any child class that needs a constructor should override this method.
Parameters
- dispatcher<Rubot::Core::Dispatcher>
-
The dispatcher that was used to create
the instance of the exiter.
23 24 25 |
# File 'lib/core/exiter.rb', line 23 def initialize(dispatcher) @dispatcher = dispatcher end |
Instance Method Details
#execute(server) ⇒ Object
Runs the exiter with the given server.
Paramters
- server<Rubot::Irc::Server>
-
Server instance the exiter should use for
messaging and information.
32 33 |
# File 'lib/core/exiter.rb', line 32 def execute(server) end |