Class: Ircmad
- Inherits:
-
Object
show all
- Includes:
- Configurable
- Defined in:
- lib/ircmad.rb,
lib/ircmad/version.rb,
lib/ircmad/irc_client.rb,
lib/ircmad/web_socket.rb,
lib/ircmad/zircon_ext.rb,
lib/ircmad/web_socket/buffer.rb
Defined Under Namespace
Classes: IRCClient, WebSocket
Constant Summary
collapse
- VERSION =
"0.0.3"
Class Method Summary
collapse
Instance Method Summary
collapse
#config, #set
Constructor Details
#initialize(&block) ⇒ Ircmad
Returns a new instance of Ircmad.
25
26
27
|
# File 'lib/ircmad.rb', line 25
def initialize(&block)
instance_eval(&block) if block_given?
end
|
Class Method Details
.get_channel ⇒ Object
20
21
22
|
# File 'lib/ircmad.rb', line 20
def get_channel
@get_channel ||= EM::Channel.new
end
|
.post_channel ⇒ Object
16
17
18
|
# File 'lib/ircmad.rb', line 16
def post_channel
@post_channel ||= EM::Channel.new
end
|
Instance Method Details
#default_config ⇒ Object
53
54
55
56
57
58
59
60
61
|
# File 'lib/ircmad.rb', line 53
def default_config
{
:server => '127.0.0.1',
:port => '6667',
:channel => '',
:channel_list => [],
:username => ''
}
end
|
#run! ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/ircmad.rb', line 29
def run!
Thread.abort_on_exception = true
EM.run do
c = default_config.merge(config).dup
EM.defer {
WebSocket.new do
set :port, c[:websocket_port]
end.run!
}
EM.defer {
IRCClient.new do
set :server, c[:host]
set :port, c[:port]
set :channel, c[:channel_list].first
set :channel_list, c[:channel_list]
set :username, c[:username]
set :password, c[:password]
end.run!
}
end
end
|