Class: Lita::Handlers::Sample
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Sample
- Defined in:
- lib/lita/handlers/sample.rb
Instance Method Summary collapse
Instance Method Details
#sample(response) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lita/handlers/sample.rb', line 9 def sample(response) total, list = response.matches.flatten total ||= 1 list = list.split.shuffle(random: SecureRandom) total.to_i.times do item = list.pop break unless item response.reply "#{item} に決めた!" end end |