Class: Portera::Participant::Availability
- Inherits:
-
Struct
- Object
- Struct
- Portera::Participant::Availability
- Defined in:
- lib/portera/participant.rb
Overview
This wrapper stores the parameters for participant availability rules
days
-
array of wday numbers, or empty array for all days
from
-
start time (parseable time string)
to
-
end time (parseable time string)
utc_offset
-
offset string or seconds from utc, if not specified assumes process-local offset
An iterator is returned when you call ‘for_range`
Instance Method Summary collapse
- #for_day_range(range) ⇒ Object
- #for_range(range) ⇒ Object
-
#initialize(*args) ⇒ Availability
constructor
A new instance of Availability.
Constructor Details
#initialize(*args) ⇒ Availability
Returns a new instance of Availability.
140 141 142 143 |
# File 'lib/portera/participant.rb', line 140 def initialize(*args) super self.days ||= [] end |
Instance Method Details
#for_day_range(range) ⇒ Object
149 150 151 152 153 154 155 156 |
# File 'lib/portera/participant.rb', line 149 def for_day_range(range) r = range.extend(Tempr::DateTimeRange) if self.days.empty? r.each_days_of_week else r.each_days_of_week(*self.days) end end |
#for_range(range) ⇒ Object
145 146 147 |
# File 'lib/portera/participant.rb', line 145 def for_range(range) apply_time_range(for_day_range(range)) end |