Sha256: 4ed6b6fad2ec12a5888badd70f3bc22a2742e35943a0beefcaffabe3566e6abc
Contents?: true
Size: 788 Bytes
Versions: 1
Compression:
Stored size: 788 Bytes
Contents
require "ruboty/deadline/version" require "ruboty/handlers/deadline" module Ruboty module Deadline NAMESPACE = 'deadline' module_function def deadlines(robot) robot.brain.data[NAMESPACE] ||= {} end def deadline_messages(robot) now = Time.now deadlines(robot).map {|task, deadline| deadline_message(task, deadline, now) } end def deadline_message(task, deadline, now = Time.now) remains = ((deadline.beginning_of_day - now.beginning_of_day) / 1.day).to_i case remains <=> 0 when 0 "―――今日は#{task}の日―――" when 1 "―――#{task}まで残り#{remains}日―――" when -1 "―――#{task}から#{-remains}日―――" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruboty-deadline-1.0.0 | lib/ruboty/deadline.rb |