Created
January 19, 2015 10:28
-
-
Save dinks/aad9256bac2d64bb87f9 to your computer and use it in GitHub Desktop.
Fix Minutes
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
| # https://blog.engineyard.com/2015/five-ruby-methods-you-should-be-using | |
| def convert_to_hours(minutes) | |
| hours = 0 | |
| until (0..60).include? minutes | |
| hours -= (60 <=> minutes) | |
| minutes += 60 * (60 <=> minutes) | |
| end | |
| { | |
| hours: hours, | |
| minutes: minutes | |
| } | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment