Sha256: faec7abcb61d79706bb91a1ccbfb5f01a37aa5ba29e8bccc6023ae5b2e674b0e
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require "lita/standups/models/standup" module Lita module Standups module Models class StandupSchedule < Base include Ohm::Callbacks include Ohm::Timestamps include Ohm::DataTypes attribute :repeat attribute :day_of_week attribute :time, Type::Time attribute :recipients, Type::Array attribute :channel reference :standup, "Lita::Standups::Models::Standup" def cron_line [ time.min, time.hour, "*", "*", (weekly? ? day_of_week_index : "*") ].join(" ") end def day_of_week_index %w(sunday monday tuesday wednesday thursday friday saturday).index(day_of_week) end def summary day_text = weekly? ? " on #{day_of_week}" : "" "ID: #{id} - running standup #{standup.name} (ID: #{standup.id}) #{repeat}#{day_text} at #{time.strftime("%H:%M")}" end def description [ "ID: #{id}", "Standup: #{standup.name} (ID: #{standup.id})", "Recipients: #{recipients.join(", ")}", "Running #{repeat} " + (weekly? ? "on #{day_of_week} " : "") + "at #{time.strftime("%H:%M")}", "Sending the result on #{channel}" ].join("\n") end def weekly? repeat == "weekly" end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lita-standups-1.0.2 | lib/lita/standups/models/standup_schedule.rb |