Class: Date

Inherits:
Object
  • Object
show all
Includes:
BusinessTime::TimeExtensions
Defined in:
lib/business_time/core_ext/date.rb

Overview

Add workday and weekday concepts to the Date class

Instance Method Summary collapse

Methods included from BusinessTime::TimeExtensions

#business_time_until, #during_business_hours?, #weekday?, #workday?

Instance Method Details

#business_dates_until(to_date, inclusive = false) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/business_time/core_ext/date.rb', line 9

def business_dates_until(to_date, inclusive = false)
  if inclusive
    (self..to_date).select(&:workday?)
  else
    (self...to_date).select(&:workday?)
  end
end

#business_days_until(to_date, inclusive = false) ⇒ Object



5
6
7
# File 'lib/business_time/core_ext/date.rb', line 5

def business_days_until(to_date, inclusive = false)
  business_dates_until(to_date, inclusive).size
end