Class: WB::Day

Inherits:
Object
  • Object
show all
Defined in:
lib/wb/day.rb

Class Method Summary collapse

Class Method Details

.working?Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
# File 'lib/wb/day.rb', line 5

def self.working?
  now = Time.now
  date = now.strftime("%Y-%m-%d")
  from, to = WB.config.working_hours
  start_time = TimeUtils.get_beginning_of(from, within: date)
  end_time = TimeUtils.get_end_of(to, within: date)

  now.between?(start_time, end_time)
end