class VirtualDate
- VirtualDate
- Reference
- Object
Defined in:
virtualdate.crConstant Summary
-
VERSION =
[VERSION_MAJOR, VERSION_MINOR, VERSION_REVISION].join('.')
-
VERSION_MAJOR =
1
-
VERSION_MINOR =
0
-
VERSION_REVISION =
2
Instance Method Summary
-
#begin : VirtualTime::TimeOrVirtualTime | Nil
Absolute begin date/time.
-
#begin=(begin __arg0 : VirtualTime::TimeOrVirtualTime | Nil)
Absolute begin date/time.
-
#due : Array(VirtualTime)
List of VirtualTimes on which the item is "on"/due/active.
-
#due=(due : Array(VirtualTime))
List of VirtualTimes on which the item is "on"/due/active.
-
#due_on?(time : VirtualTime::TimeOrVirtualTime = Time.local, times = @due)
Checks if item is due on any of its date and time specifications.
-
#due_on_any_date?(time : VirtualTime::TimeOrVirtualTime = Time.local, times = @due)
Checks if item is due on any of its date specifications (without times).
-
#due_on_any_time?(time : VirtualTime::TimeOrVirtualTime = Time.local, times = @due)
Checks if item is due on any of its time specifications (without dates).
-
#end : VirtualTime::TimeOrVirtualTime | Nil
Absolute end date/time.
-
#end=(end __arg0 : VirtualTime::TimeOrVirtualTime | Nil)
Absolute end date/time.
-
#matches_any_date?(time : VirtualTime::TimeOrVirtualTime, times, default)
Checks if any item in
times
matches the date part oftime
-
#matches_any_time?(time : VirtualTime::TimeOrVirtualTime, times, default)
Checks if any item in
times
matches the time part oftime
-
#max_shift : Time::Span | Nil
Max amount of total time by which item can be shifted, before it's considered unschedulable (false) E.g., if a company has meetings every 7 days, it probably makes no sense to reschedule a particular meeting for more than 6 days later, since on the 7th day a new meeting would be scheduled anyway.
-
#max_shift=(max_shift : Time::Span | Nil)
Max amount of total time by which item can be shifted, before it's considered unschedulable (false) E.g., if a company has meetings every 7 days, it probably makes no sense to reschedule a particular meeting for more than 6 days later, since on the 7th day a new meeting would be scheduled anyway.
-
#max_shifts : Int32
Max amount of shift attempts, before it's considered unschedulable (false)
-
#max_shifts=(max_shifts : Int32)
Max amount of shift attempts, before it's considered unschedulable (false)
-
#omit : Array(VirtualTime)
List of VirtualTimes on which the item should be "omitted", i.e.
-
#omit=(omit : Array(VirtualTime))
List of VirtualTimes on which the item should be "omitted", i.e.
-
#omit_on?(time : VirtualTime::TimeOrVirtualTime = Time.local, times = @omit)
Checks if item is omitted on any of its date and time specifications.
-
#omit_on_dates?(time : VirtualTime::TimeOrVirtualTime = Time.local, times = @omit)
Checks if item is omitted on any of its date specifications (without times).
-
#omit_on_times?(time : VirtualTime::TimeOrVirtualTime = Time.local, times = @omit)
Checks if item is omitted on any of its time specifications (without dates).
-
#on : Nil | Bool | Time::Span
Fixed value of
#on?
for this item. -
#on=(on : Nil | Bool | Time::Span)
Fixed value of
#on?
for this item. -
#on?(time : VirtualTime::TimeOrVirtualTime = Time.local, *, max_shift = @max_shift, max_shifts = @max_shifts, hint = time.is_a?(Time) ? time : Time.local)
Checks whether the item is "on" on the specified date/time.
-
#shift : Nil | Bool | Time::Span
Decision about an item to make if it falls on an omitted date/time.
-
#shift=(shift : Nil | Bool | Time::Span)
Decision about an item to make if it falls on an omitted date/time.
Instance Method Detail
Absolute begin date/time. Item is never "on" before this date.
Absolute begin date/time. Item is never "on" before this date.
Checks if item is due on any of its date and time specifications.
Checks if item is due on any of its date specifications (without times).
Checks if item is due on any of its time specifications (without dates).
Absolute end date/time. Item is never "on" after this date.
Absolute end date/time. Item is never "on" after this date.
Checks if any item in times
matches the date part of time
Checks if any item in times
matches the time part of time
Max amount of total time by which item can be shifted, before it's considered unschedulable (false) E.g., if a company has meetings every 7 days, it probably makes no sense to reschedule a particular meeting for more than 6 days later, since on the 7th day a new meeting would be scheduled anyway.
Max amount of total time by which item can be shifted, before it's considered unschedulable (false) E.g., if a company has meetings every 7 days, it probably makes no sense to reschedule a particular meeting for more than 6 days later, since on the 7th day a new meeting would be scheduled anyway.
Max amount of shift attempts, before it's considered unschedulable (false)
If shift = 1.minute
and max_shifts = 1440
, it means the item will be shifted at most
1440 minutes (1 day) compared to the original time for which it was asked, and on which it was
unschedulable due to omit times.
Max amount of shift attempts, before it's considered unschedulable (false)
If shift = 1.minute
and max_shifts = 1440
, it means the item will be shifted at most
1440 minutes (1 day) compared to the original time for which it was asked, and on which it was
unschedulable due to omit times.
List of VirtualTimes on which the item should be "omitted", i.e. on which it should not be on/due/active. For example, this list may include weekends, known holidays in a year, sick days, vacation days, etc.
Maybe this list should also implicitly contain all already scheduled items?
List of VirtualTimes on which the item should be "omitted", i.e. on which it should not be on/due/active. For example, this list may include weekends, known holidays in a year, sick days, vacation days, etc.
Maybe this list should also implicitly contain all already scheduled items?
Checks if item is omitted on any of its date and time specifications.
Checks if item is omitted on any of its date specifications (without times).
Checks if item is omitted on any of its time specifications (without dates).
Fixed value of #on?
for this item. This is useful for outright setting the item's status, without any calculations.
It can be used for things such as:
- Marking an item as parmanently on, e.g. after it has once been activated
- Marking an item as permanently off, if it was disabled until further notice
- Marking the item as always shifted/postponed by certain time (e.g. to keep it on the 'upcoming' list or something)
This field has the same union of types as #shift
.
The default is nil (no setting), to not override anything and allow for the standard calculations to run.
If defined, this setting takes precedence over #begin
and #end
.
Fixed value of #on?
for this item. This is useful for outright setting the item's status, without any calculations.
It can be used for things such as:
- Marking an item as parmanently on, e.g. after it has once been activated
- Marking an item as permanently off, if it was disabled until further notice
- Marking the item as always shifted/postponed by certain time (e.g. to keep it on the 'upcoming' list or something)
This field has the same union of types as #shift
.
The default is nil (no setting), to not override anything and allow for the standard calculations to run.
If defined, this setting takes precedence over #begin
and #end
.
Checks whether the item is "on" on the specified date/time. Item is considered "on" if it matches at least one "due" time and does not match any "omit" time. If it matches an omit time, then depending on the value of shift it may still be "on", or attempted to be rescheduled. Return values are: nil - item is not "on" / not "due" true - item is "on" (it is "due" and not on "omit" list) false - item is due, but that date is omitted, and no reschedule was requested or possible, so effectively it is not "on" Time::Span - span which is to be added to asked date to reach the earliest/closest time when item is "on"
Decision about an item to make if it falls on an omitted date/time.
Allowed values are:
- nil: treat the item as non-applicable/not-scheduled on the specified date/time
- false: treat the item as not due due to falling on an omitted date/time, after a reschedule was not attempted or was not able to find another spot
- true: treat the item as due regardless of falling on an omitted date/time
- Time::Span: shift the scheduled date/time by specified time span. Can be negative (for rescheduling before the original due) or positive (for rescheduling after the original due)).
If a time span is specified, shifting is performed incrementaly until a suitable date/time is found, or until max number of shift attempts is reached.
Decision about an item to make if it falls on an omitted date/time.
Allowed values are:
- nil: treat the item as non-applicable/not-scheduled on the specified date/time
- false: treat the item as not due due to falling on an omitted date/time, after a reschedule was not attempted or was not able to find another spot
- true: treat the item as due regardless of falling on an omitted date/time
- Time::Span: shift the scheduled date/time by specified time span. Can be negative (for rescheduling before the original due) or positive (for rescheduling after the original due)).
If a time span is specified, shifting is performed incrementaly until a suitable date/time is found, or until max number of shift attempts is reached.