Module: Useful::RubyExtensions::Date
- Included in:
- Date
- Defined in:
- lib/useful/ruby_extensions/date.rb
Constant Summary collapse
- WEEK_DAYS =
(1..5)
Instance Method Summary collapse
Instance Method Details
#week_days_between(end_date) ⇒ Object
10 11 12 13 14 |
# File 'lib/useful/ruby_extensions/date.rb', line 10 def week_days_between(end_date) raise ::ArgumentError, "End date cannot be nil." if end_date.nil? raise ::ArgumentError, "End date cannot come before questioned date." if end_date < self (self..end_date).to_a.select{|date| WEEK_DAYS.include?(date.wday)}.length end |