Created
July 8, 2016 15:53
-
-
Save stratigos/6f1b86309f314830e5ca75ad168c5579 to your computer and use it in GitHub Desktop.
Ruby: get the number of weekdays in the last year up to today.
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 characters
( (1.year.ago.to_date)..(Date.today) ).select{ |d| (1..5).include? d.wday }.size.to_f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment