Sha256: 02e002089ea1d715a3b8e1174ac67c8368b2e6a87bb83ddc1931931f9d042d6d
Contents?: true
Size: 724 Bytes
Versions: 6
Compression:
Stored size: 724 Bytes
Contents
require 'gb_work_day/interval' module GBWorkDay class Time < ::Time attr_accessor :work_week def -(other) if other.is_a?(::Time) || other.is_a?(::Date) Interval.new(self, other, week: work_week).work_days else super end end private # @return [GBWorkDay::WorkWeek] def default_week self.work_week || GBWorkDay::WorkWeek.current end class << self # Create {GBWorkingDay::Time} object from a given Time object. # Copy constructor. # # @param time [Time] def from_time(time, work_week=nil) new_time = self.at(time) new_time.work_week = work_week if work_week new_time end end end end
Version data entries
6 entries across 6 versions & 1 rubygems