Class: AIXM::Component::Timesheet
- Inherits:
-
AIXM::Component
- Object
- AIXM::Component
- AIXM::Component::Timesheet
- Defined in:
- lib/aixm/component/timesheet.rb
Overview
Timesheets define customized activity time windows.
AIXM supports only yearless dates whereas OFMX extends the model to accommodate years as well, therefore, the year part is ignored for AIXM.
Cheat Sheat in Pseudo Code:
timesheet = AIXM.timesheet(
adjust_to_dst: Boolean
dates: (AIXM.date..AIXM.date)
days: (AIXM.day..AIXM..day) # either: range of days
day: AIXM.day (default: :any) # or: single day
)
timesheet.times = (AIXM.time..AIXM_time)
Constant Summary collapse
- DAYS =
{ MON: :monday, TUE: :tuesday, WED: :wednesday, THU: :thursday, FRI: :friday, SAT: :saturday, SUN: :sunday, WD: :workday, PWD: :day_preceding_workday, AWD: :day_following_workday, LH: :holiday, PLH: :day_preceding_holiday, ALH: :day_following_holiday, ANY: :any }
- EVENTS =
{ SR: :sunrise, SS: :sunset }
- PRECEDENCES =
{ E: :first, L: :last }
Instance Attribute Summary collapse
-
#adjust_to_dst ⇒ Object
Whether to adjust to dayight savings time.
-
#dates ⇒ Object
Range of schedule dates for which this timesheet is active.
-
#days ⇒ Object
Day or days for which this timesheet is active.
-
#times ⇒ Object
Range of schedule times for which this timesheet is active.
Attributes inherited from AIXM::Component
Instance Method Summary collapse
-
#adjust_to_dst? ⇒ Object
Whether to adjust to dayight savings time.
- #day ⇒ Object
- #day=(value) ⇒ Object
-
#initialize(adjust_to_dst:, dates:, days: nil, day: AIXM::ANY_DAY) ⇒ Timesheet
constructor
See the cheat sheet for examples on how to create instances of this class.
- #inspect ⇒ String
Methods included from AIXM::Concerns::HashEquality
Methods included from AIXM::Concerns::XMLBuilder
#build_fragment, #to_uid, #to_xml
Methods included from AIXM::Concerns::Memoize
Constructor Details
#initialize(adjust_to_dst:, dates:, days: nil, day: AIXM::ANY_DAY) ⇒ Timesheet
See the cheat sheet for examples on how to create instances of this class.
87 88 89 90 91 92 93 94 |
# File 'lib/aixm/component/timesheet.rb', line 87 def initialize(adjust_to_dst:, dates:, days: nil, day: AIXM::ANY_DAY) self.adjust_to_dst, self.dates = adjust_to_dst, dates if days self.days = days else self.day = day end end |
Instance Attribute Details
#adjust_to_dst? ⇒ Boolean #adjust_to_dst=(value) ⇒ Object
See the OFMX docs for how exactly this affects dates and times.
Whether to adjust to dayight savings time.
111 112 113 |
# File 'lib/aixm/component/timesheet.rb', line 111 def adjust_to_dst? @adjust_to_dst end |
#dates ⇒ Range<AIXM::Schedule::Date> #dates=(value) ⇒ Object
Neither open beginning nor open ending is allowed.
Range of schedule dates for which this timesheet is active.
59 60 61 |
# File 'lib/aixm/component/timesheet.rb', line 59 def dates @dates end |
#day ⇒ AIXM::Schedule::Day #days ⇒ Range<AIXM::Schedule::Day> #day=(value) ⇒ Object #days=(value) ⇒ Object
Neither open beginning nor open ending is allowed.
Day or days for which this timesheet is active.
73 74 75 |
# File 'lib/aixm/component/timesheet.rb', line 73 def days @days end |
#times ⇒ Range<AIXM::Schedule::Time>? #times=(value) ⇒ Object
Either open beginning or open ending is allowed.
Range of schedule times for which this timesheet is active.
83 84 85 |
# File 'lib/aixm/component/timesheet.rb', line 83 def times @times end |
Instance Method Details
#adjust_to_dst? ⇒ Boolean #adjust_to_dst=(value) ⇒ Object
See the OFMX docs for how exactly this affects dates and times.
Whether to adjust to dayight savings time.
111 112 113 |
# File 'lib/aixm/component/timesheet.rb', line 111 def adjust_to_dst? @adjust_to_dst end |
#day ⇒ Object
135 136 137 |
# File 'lib/aixm/component/timesheet.rb', line 135 def day @days unless @days.instance_of? Range end |
#day=(value) ⇒ Object
139 140 141 142 |
# File 'lib/aixm/component/timesheet.rb', line 139 def day=(value) fail(ArgumentError, 'invalid day') unless value.instance_of? AIXM::Schedule::Day @days = value end |
#inspect ⇒ String
97 98 99 |
# File 'lib/aixm/component/timesheet.rb', line 97 def inspect %Q(#<#{self.class} dates=#{dates.inspect}>) end |