class Lita::Updates::Report
Constants
- NOTHING
Attributes
data[R]
robot[R]
user[R]
Public Class Methods
new(robot, data, user)
click to toggle source
# File lib/lita/updates/report.rb, line 4 def initialize(robot, data, user) @robot = robot @data = data @user = user end
Public Instance Methods
call()
click to toggle source
# File lib/lita/updates/report.rb, line 10 def call robot.send_message Lita::Source.new(user: user), text end
Private Instance Methods
answer(prompt, value)
click to toggle source
# File lib/lita/updates/report.rb, line 18 def answer(prompt, value) return "" if value.strip.empty? || value[NOTHING] "#{prompt}\n #{value}" end
answers()
click to toggle source
# File lib/lita/updates/report.rb, line 24 def answers [ answer("What have you just been working on?", yesterday), answer("What's next?", today), answer("What blockers are impeding your progress?", blockers) ] end
blockers()
click to toggle source
# File lib/lita/updates/report.rb, line 32 def blockers data.read "blockers" end
target()
click to toggle source
# File lib/lita/updates/report.rb, line 36 def target Lita::Room.find_by_name Lita.config.handlers.updates.target end
text()
click to toggle source
# File lib/lita/updates/report.rb, line 40 def text <<-TEXT.strip #{user.name} posted a status update: #{answers.join("\n\n")} TEXT end
today()
click to toggle source
# File lib/lita/updates/report.rb, line 47 def today data.read "today" end
yesterday()
click to toggle source
# File lib/lita/updates/report.rb, line 51 def yesterday data.read "yesterday" end