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
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/lita/handlers/debug_queue.rb', line 26 def add(response) return unless check_room!(response) student = response.user.mention_name if @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
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/lita/handlers/debug_queue.rb', line 37 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
81 82 83 84 85 |
# File 'lib/lita/handlers/debug_queue.rb', line 81 def clear(response) return unless check_room!(response) @room.clear! response.reply("Sounds like time for :beer: and ping pong!") end |
#count(response) ⇒ Object
53 54 55 56 |
# File 'lib/lita/handlers/debug_queue.rb', line 53 def count(response) return unless check_room!(response) response.reply("Hackers seeking fresh eyes: #{@room.count} in #{@room.name}") end |
#drop(response) ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/lita/handlers/debug_queue.rb', line 70 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
58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/lita/handlers/debug_queue.rb', line 58 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
48 49 50 51 |
# File 'lib/lita/handlers/debug_queue.rb', line 48 def show(response) return unless check_room!(response) response.reply("Queue for #{@room.name} => #{@room.queue}") end |