Class: Biz::Schedule

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/biz/schedule.rb

Instance Method Summary collapse

Constructor Details

#initialize(&config) ⇒ Schedule

Returns a new instance of Schedule.



6
7
8
# File 'lib/biz/schedule.rb', line 6

def initialize(&config)
  @configuration = Configuration.new(&config)
end

Instance Method Details

#datesObject Also known as: date



21
22
23
# File 'lib/biz/schedule.rb', line 21

def dates
  Dates.new(self)
end

#in_hours?(time) ⇒ Boolean Also known as: business_hours?

Returns:

  • (Boolean)


35
36
37
# File 'lib/biz/schedule.rb', line 35

def in_hours?(time)
  Calculation::Active.new(self, time).result
end

#in_zoneObject



41
42
43
# File 'lib/biz/schedule.rb', line 41

def in_zone
  Time.new(time_zone)
end

#periodsObject



17
18
19
# File 'lib/biz/schedule.rb', line 17

def periods
  Periods.new(self)
end

#time(scalar, unit) ⇒ Object



27
28
29
# File 'lib/biz/schedule.rb', line 27

def time(scalar, unit)
  Calculation::ForDuration.with_unit(self, scalar, unit)
end

#within(origin, terminus) ⇒ Object



31
32
33
# File 'lib/biz/schedule.rb', line 31

def within(origin, terminus)
  Calculation::DurationWithin.new(self, TimeSegment.new(origin, terminus))
end