class Lita::Updates::Commands::GetSchedule
Attributes
redis[R]
robot[R]
user[R]
Public Class Methods
call(robot, redis, user)
click to toggle source
# File lib/lita/updates/commands/get_schedule.rb, line 2 def self.call(robot, redis, user) new(robot, redis, user).call end
new(robot, redis, user)
click to toggle source
# File lib/lita/updates/commands/get_schedule.rb, line 6 def initialize(robot, redis, user) @robot = robot @redis = redis @user = user end
Public Instance Methods
call()
click to toggle source
# File lib/lita/updates/commands/get_schedule.rb, line 12 def call hash = schedule[user.mention_name] if hash.nil? say "No standup scheduled" else say "Standup scheduled for #{hash["time"]} on #{hash["days"].join(", ")}" end end
Private Instance Methods
say(message)
click to toggle source
# File lib/lita/updates/commands/get_schedule.rb, line 37 def say(message) robot.send_message Lita::Source.new(:user => user), message end
schedule()
click to toggle source
# File lib/lita/updates/commands/get_schedule.rb, line 26 def schedule @schedule ||= JSON.load schedule_raw end
schedule_raw()
click to toggle source
# File lib/lita/updates/commands/get_schedule.rb, line 30 def schedule_raw raw = redis.get("lita-updates:schedule") return "{}" if raw.nil? || raw.empty? raw end