Class: Lita::Handlers::DebugQueue
- Inherits:
-
Object
- Object
- Lita::Handlers::DebugQueue
- Extended by:
- Lita::Handler::ChatRouter
- Defined in:
- lib/lita/handlers/debug_queue.rb
Instance Method Summary collapse
- #add(response) ⇒ Object
- #cancel(response) ⇒ Object
- #clear(response) ⇒ Object
- #count(response) ⇒ Object
- #drop(response) ⇒ Object
- #next(response) ⇒ Object
- #show(response) ⇒ Object
Instance Method Details
#add(response) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/lita/handlers/debug_queue.rb', line 27 def add(response) return unless check_room!(response) student = response.user.mention_name if closed?(DateTime.now) response.reply("#{student}: Sorry, the queue is closed for the day.") elsif @room.include?(student) response.reply("#{student}: Easy there killer. You're already on the list.") else @room.add(student) response.reply("#{student}: Help is coming soon.") end end |
#cancel(response) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/lita/handlers/debug_queue.rb', line 40 def cancel(response) return unless check_room!(response) student = response.user.mention_name if @room.include?(student) @room.remove(student) response.reply("#{student}: Glad you figured it out! :)") else response.reply("#{student}: You know you're not in the queue, right?") end end |
#clear(response) ⇒ Object
84 85 86 87 88 |
# File 'lib/lita/handlers/debug_queue.rb', line 84 def clear(response) return unless check_room!(response) @room.clear! response.reply("Sounds like time for :beer: and ping pong!") end |
#count(response) ⇒ Object
56 57 58 59 |
# File 'lib/lita/handlers/debug_queue.rb', line 56 def count(response) return unless check_room!(response) response.reply("Hackers seeking fresh eyes: #{@room.count} in #{@room.name}") end |
#drop(response) ⇒ Object
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/lita/handlers/debug_queue.rb', line 73 def drop(response) return unless check_room!(response) student = response.args[1] if @room.include?(student) @room.remove(student) response.reply("#{student} has been removed from the queue.") else response.reply("#{student} is not in the queue for #{@room}!") end end |
#next(response) ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/lita/handlers/debug_queue.rb', line 61 def next(response) return unless check_room!(response) if @room.count.zero? response.reply("The queue is empty. Sounds like you could use a break. :)") else student = @room.next target = target_for(student) robot.(target, "@#{student}: You're up. Let's debug :allthethings:!") response.reply("#{student} is up next and has been notified.") end end |
#show(response) ⇒ Object
51 52 53 54 |
# File 'lib/lita/handlers/debug_queue.rb', line 51 def show(response) return unless check_room!(response) response.reply("Queue for #{@room.name} => #{@room.queue}") end |