class Roxbury::BusinessDay
Wraps a specific date with its working hours schedule
Public Class Methods
new(date, working_hours)
click to toggle source
# File lib/roxbury/business_day.rb, line 4 def initialize date, working_hours @date = date @working_hours = working_hours end
Public Instance Methods
at_beginning()
click to toggle source
# File lib/roxbury/business_day.rb, line 29 def at_beginning @working_hours.at_beginning @date end
at_end()
click to toggle source
# File lib/roxbury/business_day.rb, line 33 def at_end @working_hours.at_end @date end
ends_before?(timestamp)
click to toggle source
# File lib/roxbury/business_day.rb, line 25 def ends_before? timestamp same_day?(timestamp) && @working_hours.ends_before?(timestamp) end
include?(timestamp)
click to toggle source
# File lib/roxbury/business_day.rb, line 17 def include? timestamp same_day?(timestamp) && @working_hours.include?(timestamp) end
number_of_working_hours(*args)
click to toggle source
# File lib/roxbury/business_day.rb, line 9 def number_of_working_hours *args @working_hours.quantity *args end
same_day?(timestamp)
click to toggle source
# File lib/roxbury/business_day.rb, line 13 def same_day? timestamp timestamp.to_date == @date.to_date end
starts_after?(timestamp)
click to toggle source
# File lib/roxbury/business_day.rb, line 21 def starts_after? timestamp same_day?(timestamp) && @working_hours.starts_after?(timestamp) end