Class: Coffeemaker::Bot::Irc
- Inherits:
-
Object
- Object
- Coffeemaker::Bot::Irc
- Defined in:
- lib/coffeemaker/bot/irc.rb,
lib/coffeemaker/bot/irc/message.rb,
lib/coffeemaker/bot/irc/commands.rb,
lib/coffeemaker/bot/irc/connection.rb
Defined Under Namespace
Modules: Commands, Connection Classes: Message
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#nick ⇒ Object
readonly
Returns the value of attribute nick.
-
#on_connect ⇒ Object
Returns the value of attribute on_connect.
-
#on_message ⇒ Object
Returns the value of attribute on_message.
-
#pass ⇒ Object
readonly
Returns the value of attribute pass.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(options) ⇒ Irc
constructor
A new instance of Irc.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(options) ⇒ Irc
Returns a new instance of Irc.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/coffeemaker/bot/irc.rb', line 14 def initialize() @host = .delete(:irc_host) @port = .delete(:irc_port) @nick = .delete(:nick) @pass = .delete(:pass) @user = .delete(:user) @on_message = .delete(:on_message) @logger = .delete(:logger) @ssl = .delete(:ssl) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
9 10 11 |
# File 'lib/coffeemaker/bot/irc.rb', line 9 def host @host end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
9 10 11 |
# File 'lib/coffeemaker/bot/irc.rb', line 9 def logger @logger end |
#nick ⇒ Object (readonly)
Returns the value of attribute nick.
9 10 11 |
# File 'lib/coffeemaker/bot/irc.rb', line 9 def nick @nick end |
#on_connect ⇒ Object
Returns the value of attribute on_connect.
8 9 10 |
# File 'lib/coffeemaker/bot/irc.rb', line 8 def on_connect @on_connect end |
#on_message ⇒ Object
Returns the value of attribute on_message.
8 9 10 |
# File 'lib/coffeemaker/bot/irc.rb', line 8 def @on_message end |
#pass ⇒ Object (readonly)
Returns the value of attribute pass.
9 10 11 |
# File 'lib/coffeemaker/bot/irc.rb', line 9 def pass @pass end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
9 10 11 |
# File 'lib/coffeemaker/bot/irc.rb', line 9 def port @port end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
9 10 11 |
# File 'lib/coffeemaker/bot/irc.rb', line 9 def user @user end |
Instance Method Details
#start ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/coffeemaker/bot/irc.rb', line 25 def start @connection = EM.connect(@host, @port, Connection) do |c| c.host = @host c.port = @port c.pass = @pass c.user = @user c.nick = @nick c. = @on_message c.on_connect = @on_connect c.logger = @logger c.ssl = @ssl end end |
#stop ⇒ Object
39 40 41 |
# File 'lib/coffeemaker/bot/irc.rb', line 39 def stop @connection.close_connection end |