Class: Lita::Standups::Models::StandupSchedule
- Includes:
- Ohm::Callbacks, Ohm::DataTypes, Ohm::Timestamps
- Defined in:
- lib/lita/standups/models/standup_schedule.rb
Instance Method Summary collapse
- #cron_line ⇒ Object
- #cron_line_week ⇒ Object
- #daily? ⇒ Boolean
- #day_of_week_index ⇒ Object
- #description ⇒ Object
- #summary ⇒ Object
- #weekly? ⇒ Boolean
- #workdays? ⇒ Boolean
Methods inherited from Base
Instance Method Details
#cron_line ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lita/standups/models/standup_schedule.rb', line 20 def cron_line [ time.min, time.hour, "*", "*", cron_line_week, "UTC" ].join(" ") end |
#cron_line_week ⇒ Object
31 32 33 34 35 |
# File 'lib/lita/standups/models/standup_schedule.rb', line 31 def cron_line_week return "*" if daily? return "1,2,3,4,5" if workdays? return day_of_week_index if weekly? end |
#daily? ⇒ Boolean
56 57 58 |
# File 'lib/lita/standups/models/standup_schedule.rb', line 56 def daily? repeat == "daily" end |
#day_of_week_index ⇒ Object
37 38 39 |
# File 'lib/lita/standups/models/standup_schedule.rb', line 37 def day_of_week_index %w(sunday monday tuesday wednesday thursday friday saturday).index(day_of_week) end |
#description ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/lita/standups/models/standup_schedule.rb', line 46 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 |
#summary ⇒ Object
41 42 43 44 |
# File 'lib/lita/standups/models/standup_schedule.rb', line 41 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 |
#weekly? ⇒ Boolean
60 61 62 |
# File 'lib/lita/standups/models/standup_schedule.rb', line 60 def weekly? repeat == "weekly" end |
#workdays? ⇒ Boolean
64 65 66 |
# File 'lib/lita/standups/models/standup_schedule.rb', line 64 def workdays? repeat == "workdays" end |