Sha256: cb1c648d600c676f961fd83c2314e5f3bbd63429471f88c2d29bca0fc07c4b54
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require 'json' require 'eventmachine' require 'em-websocket' require 'zircon' require "ircmad/version" require "ircmad/zircon_ext" require "ircmad/configurable" require "ircmad/irc_client" require "ircmad/web_socket" class Ircmad include Configurable class << self def post_channel @post_channel ||= EM::Channel.new end def get_channel @get_channel ||= EM::Channel.new end end def initialize(&block) instance_eval(&block) if block_given? end 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 def default_config { :server => '127.0.0.1', :port => '6667', :channel => '', :channel_list => [], :username => '' } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ircmad-0.0.3 | lib/ircmad.rb |