Class: Biz::Schedule
- Inherits:
-
Object
- Object
- Biz::Schedule
- Extended by:
- Forwardable
- Defined in:
- lib/biz/schedule.rb
Instance Method Summary collapse
- #&(other) ⇒ Object
- #dates ⇒ Object (also: #date)
- #in_hours?(time) ⇒ Boolean (also: #business_hours?)
- #in_zone ⇒ Object
-
#initialize(&config) ⇒ Schedule
constructor
A new instance of Schedule.
- #on_break?(time) ⇒ Boolean
- #on_holiday?(time) ⇒ Boolean
- #periods ⇒ Object
- #time(scalar, unit) ⇒ Object
- #within(origin, terminus) ⇒ Object
Constructor Details
#initialize(&config) ⇒ Schedule
Returns a new instance of Schedule.
8 9 10 |
# File 'lib/biz/schedule.rb', line 8 def initialize(&config) @configuration = Configuration.new(&config) end |
Instance Method Details
#&(other) ⇒ Object
57 58 59 |
# File 'lib/biz/schedule.rb', line 57 def &(other) self.class.new(&(configuration & other.configuration)) end |
#dates ⇒ Object Also known as: date
25 26 27 |
# File 'lib/biz/schedule.rb', line 25 def dates Dates.new(self) end |
#in_hours?(time) ⇒ Boolean Also known as: business_hours?
39 40 41 |
# File 'lib/biz/schedule.rb', line 39 def in_hours?(time) Calculation::Active.new(self, time).result end |
#in_zone ⇒ Object
53 54 55 |
# File 'lib/biz/schedule.rb', line 53 def in_zone Time.new(time_zone) end |
#on_break?(time) ⇒ Boolean
45 46 47 |
# File 'lib/biz/schedule.rb', line 45 def on_break?(time) Calculation::OnBreak.new(self, time).result end |
#on_holiday?(time) ⇒ Boolean
49 50 51 |
# File 'lib/biz/schedule.rb', line 49 def on_holiday?(time) Calculation::OnHoliday.new(self, time).result end |
#periods ⇒ Object
21 22 23 |
# File 'lib/biz/schedule.rb', line 21 def periods Periods::Proxy.new(self) end |
#time(scalar, unit) ⇒ Object
31 32 33 |
# File 'lib/biz/schedule.rb', line 31 def time(scalar, unit) Calculation::ForDuration.with_unit(self, scalar, unit) end |
#within(origin, terminus) ⇒ Object
35 36 37 |
# File 'lib/biz/schedule.rb', line 35 def within(origin, terminus) Calculation::DurationWithin.new(self, TimeSegment.new(origin, terminus)) end |