Class: Lita::Handlers::Butt
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Butt
- Defined in:
- lib/lita/handlers/butt.rb
Overview
s/chatbot/chatbutt/
Instance Method Summary collapse
- #butt(response) ⇒ Object
-
#escape(butt, adapter = robot.config.robot.adapter) ⇒ Object
Properly escape the butt for a given chat service.
- #make_butt(width = 1) ⇒ Object
Instance Method Details
#butt(response) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/lita/handlers/butt.rb', line 8 def butt(response) groups = response.matches.first width = groups.first.size butt = make_butt width if groups.last == 's' response.reply(escape([butt, butt].join(' '))) else response.reply(escape(butt)) end end |
#escape(butt, adapter = robot.config.robot.adapter) ⇒ Object
Properly escape the butt for a given chat service
26 27 28 29 30 31 32 33 |
# File 'lib/lita/handlers/butt.rb', line 26 def escape(butt, adapter = robot.config.robot.adapter) case adapter when :slack "`#{butt}`" else butt end end |
#make_butt(width = 1) ⇒ Object
20 21 22 23 |
# File 'lib/lita/handlers/butt.rb', line 20 def make_butt(width = 1) bottom = '_' * width "(#{bottom})#{bottom})" end |