Class: Lita::Handlers::Pwm

Inherits:
Handler
  • Object
show all
Defined in:
lib/lita/handlers/pwm.rb

Instance Method Summary collapse

Instance Method Details

#generate_password(response) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/lita/handlers/pwm.rb', line 16

def generate_password(response)
  length = response.matches[0][0].to_i
  if length == 0
    response.reply ::Pwm.password
  elsif length < 8
    response.reply "Requested length #{length} is too short!"
  else
    response.reply ::Pwm.password(length)
  end
end