Class: Lita::Handlers::DebugQueue
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::DebugQueue
- 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
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/lita/handlers/debug_queue.rb', line 23 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
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/lita/handlers/debug_queue.rb', line 34 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
78 79 80 81 82 |
# File 'lib/lita/handlers/debug_queue.rb', line 78 def clear(response) return unless check_room!(response) @room.clear! response.reply("Sounds like time for :beer: and ping pong!") end |
#count(response) ⇒ Object
50 51 52 53 |
# File 'lib/lita/handlers/debug_queue.rb', line 50 def count(response) return unless check_room!(response) response.reply("Hackers seeking fresh eyes: #{@room.count} in #{@room.name}") end |
#drop(response) ⇒ Object
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/lita/handlers/debug_queue.rb', line 67 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
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/lita/handlers/debug_queue.rb', line 55 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
45 46 47 48 |
# File 'lib/lita/handlers/debug_queue.rb', line 45 def show(response) return unless check_room!(response) response.reply("Queue for #{@room.name} => #{@room.queue}") end |