Class: Coffeemaker::Runner
- Inherits:
-
Object
- Object
- Coffeemaker::Runner
- Defined in:
- lib/coffeemaker/runner.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Runner
constructor
A new instance of Runner.
- #start ⇒ Object
Constructor Details
#initialize(argv) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 13 14 |
# File 'lib/coffeemaker/runner.rb', line 8 def initialize(argv) @options = (argv) @logger = Logger.new(@options.delete(:logfile)) @logger.level = @options.delete(:log_level) @channels = @options.delete(:channels) end |
Instance Method Details
#start ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/coffeemaker/runner.rb', line 16 def start EM.run do bot = Coffeemaker::Bot.new(@options.merge(:logger => @logger)) bot.start do |irc| @channels.each { |channel| irc.join(channel) } end trap ("INT") do bot.stop EM.stop end end end |