Module: Workpattern::Utility

Defined in:
lib/workpattern/utility/base.rb

Overview

Mixins expected to be used in more than one class

Since:

  • 0.2.0

Instance Method Summary collapse

Instance Method Details

#midnight_after(adate) ⇒ DateTime

TODO:

Consider mixin for DateTime class

Returns the supplied DateTime at the very start of the next day.

Since:

  • 0.2.0


27
28
29
# File 'lib/workpattern/utility/base.rb', line 27

def midnight_after(adate)
  return midnight_before(adate.next_day)
end

#midnight_before(adate) ⇒ DateTime

TODO:

Consider mixin for DateTime class

Returns the supplied DateTime at the very start of the day.

Since:

  • 0.2.0


16
17
18
# File 'lib/workpattern/utility/base.rb', line 16

def midnight_before(adate)
  return adate -(HOUR * adate.hour) - (MINUTE * adate.min)
end