class GBWorkDay::Time
Attributes
work_week[RW]
Private Class Methods
from_time(time, work_week=nil)
click to toggle source
Create {GBWorkingDay::Time} object from a given Time
object. Copy constructor.
@param time [Time]
# File lib/gb_work_day/helpers/time.rb, line 26 def from_time(time, work_week=nil) new_time = self.at(time) new_time.work_week = work_week if work_week new_time end
Public Instance Methods
-(other)
click to toggle source
Calls superclass method
Time#-
# File lib/gb_work_day/helpers/time.rb, line 6 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 Instance Methods
default_week()
click to toggle source
@return [GBWorkDay::WorkWeek]
# File lib/gb_work_day/helpers/time.rb, line 17 def default_week self.work_week || GBWorkDay::WorkWeek.current end