Sha256: d21275dd3c56dde84e26395547bf58127f4b07fa76b968d03f79f56b129f4c44

Contents?: true

Size: 802 Bytes

Versions: 7

Compression:

Stored size: 802 Bytes

Contents

module Workpattern

  # Mixins expected to be used in more than one class
  #
  # @since 0.2.0
  #
  module Utility

    # Returns the supplied <tt>DateTime</tt> at the very start of the day.
    #
    # @param [DateTime] adate is the <tt>DateTime</tt> to be changed
    # @return [DateTime] 
    # 
    # @todo Consider mixin for DateTime class 
    #
    def midnight_before(adate)
      return adate -(HOUR * adate.hour) - (MINUTE * adate.min)
    end
    
    # Returns the supplied <tt>DateTime</tt> at the very start of the next day.
    #
    # @param [DateTime] adate is the <tt>DateTime</tt> to be changed
    # @return [DateTime] 
    # 
    # @todo Consider mixin for DateTime class  
    #
    def midnight_after(adate)
      return midnight_before(adate.next_day)
    end
    
  end
end  

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
workpattern-0.4.0 lib/workpattern/utility/base.rb
workpattern-0.3.6 lib/workpattern/utility/base.rb
workpattern-0.3.5 lib/workpattern/utility/base.rb
workpattern-0.3.4 lib/workpattern/utility/base.rb
workpattern-0.3.3 lib/workpattern/utility/base.rb
workpattern-0.3.2 lib/workpattern/utility/base.rb
workpattern-0.3.1 lib/workpattern/utility/base.rb