Class: Biz::Calculation::Active

Inherits:
Object
  • Object
show all
Defined in:
lib/biz/calculation/active.rb

Instance Method Summary collapse

Constructor Details

#initialize(schedule, time) ⇒ Active

Returns a new instance of Active.



7
8
9
10
# File 'lib/biz/calculation/active.rb', line 7

def initialize(schedule, time)
  @schedule = schedule
  @time     = time
end

Instance Method Details

#resultObject



12
13
14
15
16
# File 'lib/biz/calculation/active.rb', line 12

def result
  return in_hours? && active? if schedule.shifts.none?

  schedule.periods.after(time).first.contains?(time)
end