class Lita::Handlers::Sample

Public Instance Methods

sample(response) click to toggle source
# 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