Class: Lita::Handlers::Faker

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

Overview

Generator of fake data such as names, addresses, and phone numbers for the Lita chat bot.

Instance Method Summary collapse

Instance Method Details

#route_faker(response) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/lita/handlers/faker.rb', line 22

def route_faker(response)
  matches = response.matches[0]
  namespace = ::Faker.const_get(matches[0].split('_').map(&:capitalize).join.to_sym)
  command = namespace.method(matches[1].to_sym)

  response.reply(command.call)
end