Created
September 1, 2014 20:33
-
-
Save samir/fe02a7124c2e7add6742 to your computer and use it in GitHub Desktop.
Revisions
-
samir created this gist
Sep 1, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ module BusinessDay def next_business_day self.skip_weekends self, 1 end def previous_business_day self.skip_weekends self, -1 end protected def skip_weekends(date, inc) date += inc while (date.wday % 7 == 0) or (date.wday % 7 == 6) do date += inc end date end end Date.send :include, BusinessDay