Module: Montrose::Chainable
- Included in:
- Montrose, Recurrence
- Defined in:
- lib/montrose/chainable.rb
Instance Method Summary collapse
-
#at(time) ⇒ Montrose::Recurrence
Create a recurrence at given time.
-
#between(date_range) ⇒ Montrose::Recurrence
Create a recurrence occurring during date range.
- #branch(options) ⇒ Object
-
#daily(options = {}) ⇒ Montrose::Recurrence
Create a daily recurrence.
-
#day_of_month(days, *extras) ⇒ Montrose::Recurrence
(also: #mday)
Create a recurrence for given days of month.
-
#day_of_week(weekdays, *extras) ⇒ Montrose::Recurrence
(also: #day)
Create a recurrence for given days of week.
-
#day_of_year(days, *extras) ⇒ Montrose::Recurrence
(also: #yday)
Create a recurrence for given days of year.
- #default_options ⇒ Object
-
#during(time_of_day, *extras) ⇒ Montrose::Recurrence
Create a recurrence occurring within a time-of-day range or ranges.
-
#every(frequency, options = {}) ⇒ Montrose::Recurrence
Create a recurrence from the given frequency.
-
#except(date) ⇒ Montrose::Recurrence
Create a recurrence with dates except dates given.
-
#hour_of_day(hours, *extras) ⇒ Montrose::Recurrence
(also: #hour)
Create a recurrence for given hours of day.
-
#hourly(options = {}) ⇒ Montrose::Recurrence
Create a hourly recurrence.
-
#merge(other = {}) ⇒ Montrose::Recurrence
Create a new recurrence combining options of self and other.
-
#minutely(options = {}) ⇒ Montrose::Recurrence
Create a minutely recurrence.
-
#month_of_year(months, *extras) ⇒ Montrose::Recurrence
(also: #month)
Create a recurrence for given months of year.
-
#monthly(options = {}) ⇒ Montrose::Recurrence
Create a monthly recurrence.
-
#on(day) ⇒ Montrose::Recurrence
Create a recurrence through :on option.
-
#starts(starts_at) ⇒ Montrose::Recurrence
(also: #starting)
Create a recurrence starting at given timestamp.
-
#total(total) ⇒ Montrose::Recurrence
(also: #repeat)
Create a recurrence that ends after given number of occurrences.
-
#until(ends_at) ⇒ Montrose::Recurrence
(also: #ending)
Create a recurrence ending at given timestamp.
-
#week_of_year(weeks, *extras) ⇒ Montrose::Recurrence
Create a recurrence for given weeks of year.
-
#weekly(options = {}) ⇒ Montrose::Recurrence
Create a weekly recurrence.
-
#yearly(options = {}) ⇒ Montrose::Recurrence
Create a yearly recurrence.
Instance Method Details
#at(time) ⇒ Montrose::Recurrence
Create a recurrence at given time
212 213 214 |
# File 'lib/montrose/chainable.rb', line 212 def at(time) merge(at: time) end |
#between(date_range) ⇒ Montrose::Recurrence
Create a recurrence occurring during date range.
167 168 169 |
# File 'lib/montrose/chainable.rb', line 167 def between(date_range) merge(between: date_range) end |
#branch(options) ⇒ Object
356 357 358 |
# File 'lib/montrose/chainable.rb', line 356 def branch() Montrose::Recurrence.new() end |
#daily(options = {}) ⇒ Montrose::Recurrence
Create a daily recurrence.
77 78 79 |
# File 'lib/montrose/chainable.rb', line 77 def daily( = {}) branch .merge(every: :day) end |
#day_of_month(days, *extras) ⇒ Montrose::Recurrence Also known as: mday
Create a recurrence for given days of month
241 242 243 |
# File 'lib/montrose/chainable.rb', line 241 def day_of_month(days, *extras) merge(mday: days.array_concat(extras)) end |
#day_of_week(weekdays, *extras) ⇒ Montrose::Recurrence Also known as: day
Create a recurrence for given days of week
257 258 259 |
# File 'lib/montrose/chainable.rb', line 257 def day_of_week(weekdays, *extras) merge(day: weekdays.array_concat(extras)) end |
#day_of_year(days, *extras) ⇒ Montrose::Recurrence Also known as: yday
Create a recurrence for given days of year
273 274 275 |
# File 'lib/montrose/chainable.rb', line 273 def day_of_year(days, *extras) merge(yday: days.array_concat(extras)) end |
#default_options ⇒ Object
361 362 363 |
# File 'lib/montrose/chainable.rb', line 361 def @default_options ||= Montrose::Options.new end |
#during(time_of_day, *extras) ⇒ Montrose::Recurrence
Create a recurrence occurring within a time-of-day range or ranges. Given time ranges will parse as times-of-day and ignore given dates.
184 185 186 |
# File 'lib/montrose/chainable.rb', line 184 def during(time_of_day, *extras) merge(during: time_of_day.array_concat(extras)) end |
#every(frequency, options = {}) ⇒ Montrose::Recurrence
Create a recurrence from the given frequency
23 24 25 |
# File 'lib/montrose/chainable.rb', line 23 def every(frequency, = {}) branch .merge(every: frequency) end |
#except(date) ⇒ Montrose::Recurrence
Create a recurrence with dates except dates given
226 227 228 |
# File 'lib/montrose/chainable.rb', line 226 def except(date) merge(except: date) end |
#hour_of_day(hours, *extras) ⇒ Montrose::Recurrence Also known as: hour
Create a recurrence for given hours of day
289 290 291 |
# File 'lib/montrose/chainable.rb', line 289 def hour_of_day(hours, *extras) merge(hour: hours.array_concat(extras)) end |
#hourly(options = {}) ⇒ Montrose::Recurrence
Create a hourly recurrence.
59 60 61 |
# File 'lib/montrose/chainable.rb', line 59 def hourly( = {}) branch .merge(every: :hour) end |
#merge(other = {}) ⇒ Montrose::Recurrence
Create a new recurrence combining options of self and other. The value of entries with duplicate keys will be those of other
351 352 353 |
# File 'lib/montrose/chainable.rb', line 351 def merge(other = {}) branch .merge(other) end |
#minutely(options = {}) ⇒ Montrose::Recurrence
Create a minutely recurrence.
41 42 43 |
# File 'lib/montrose/chainable.rb', line 41 def minutely( = {}) branch .merge(every: :minute) end |
#month_of_year(months, *extras) ⇒ Montrose::Recurrence Also known as: month
Create a recurrence for given months of year
305 306 307 |
# File 'lib/montrose/chainable.rb', line 305 def month_of_year(months, *extras) merge(month: months.array_concat(extras)) end |
#monthly(options = {}) ⇒ Montrose::Recurrence
Create a monthly recurrence.
109 110 111 |
# File 'lib/montrose/chainable.rb', line 109 def monthly( = {}) branch .merge(every: :month) end |
#on(day) ⇒ Montrose::Recurrence
Create a recurrence through :on option
198 199 200 |
# File 'lib/montrose/chainable.rb', line 198 def on(day) merge(on: day) end |
#starts(starts_at) ⇒ Montrose::Recurrence Also known as: starting
Create a recurrence starting at given timestamp.
139 140 141 |
# File 'lib/montrose/chainable.rb', line 139 def starts(starts_at) merge(starts: starts_at) end |
#total(total) ⇒ Montrose::Recurrence Also known as: repeat
Create a recurrence that ends after given number of occurrences
335 336 337 |
# File 'lib/montrose/chainable.rb', line 335 def total(total) merge(total: total) end |
#until(ends_at) ⇒ Montrose::Recurrence Also known as: ending
Create a recurrence ending at given timestamp.
153 154 155 |
# File 'lib/montrose/chainable.rb', line 153 def until(ends_at) merge(until: ends_at) end |
#week_of_year(weeks, *extras) ⇒ Montrose::Recurrence
Create a recurrence for given weeks of year
321 322 323 |
# File 'lib/montrose/chainable.rb', line 321 def week_of_year(weeks, *extras) merge(week: weeks.array_concat(extras)) end |
#weekly(options = {}) ⇒ Montrose::Recurrence
Create a weekly recurrence.
94 95 96 |
# File 'lib/montrose/chainable.rb', line 94 def weekly( = {}) branch .merge(every: :week) end |
#yearly(options = {}) ⇒ Montrose::Recurrence
Create a yearly recurrence.
126 127 128 |
# File 'lib/montrose/chainable.rb', line 126 def yearly( = {}) branch .merge(every: :year) end |