Class: Lita::Handlers::Retro
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Retro
- Defined in:
- lib/lita/handlers/retro.rb
Instance Method Summary collapse
- #add_bad(response) ⇒ Object
- #add_good(response) ⇒ Object
- #add_neutral(response) ⇒ Object
- #clear(response) ⇒ Object
- #list(response) ⇒ Object
Instance Method Details
#add_bad(response) ⇒ Object
24 25 26 |
# File 'lib/lita/handlers/retro.rb', line 24 def add_bad(response) add_type("bad", response) end |
#add_good(response) ⇒ Object
28 29 30 |
# File 'lib/lita/handlers/retro.rb', line 28 def add_good(response) add_type("good", response) end |
#add_neutral(response) ⇒ Object
32 33 34 |
# File 'lib/lita/handlers/retro.rb', line 32 def add_neutral(response) add_type("neutral", response) end |
#clear(response) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/lita/handlers/retro.rb', line 50 def clear(response) %w(good bad neutral).map do |type| redis.smembers(type).each { |id| redis.del("#{type}:#{id}") } redis.del(type) end response.reply(t("clear")) end |
#list(response) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lita/handlers/retro.rb', line 36 def list(response) topics = [ list_type("good"), list_type("bad"), list_type("neutral") ].compact if topics.empty? response.reply(t("no_topics")) else response.reply(topics.join("\n")) end end |