Module: DateHandler
- Defined in:
- lib/fafx/date_handler.rb
Class Method Summary collapse
Class Method Details
.get(date) ⇒ Object
2 3 4 5 |
# File 'lib/fafx/date_handler.rb', line 2 def get(date) raise Fafx::DateError, 'Not a valid Date object' unless date.class == Date handle_weekend(date).to_s end |
.handle_weekend(date) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/fafx/date_handler.rb', line 9 def handle_weekend(date) case date.wday when 6 # Saturday date -= 1 when 0 # Sunday date -= 2 end date end |