Skip to content

Instantly share code, notes, and snippets.

@dinks
Created January 19, 2015 10:28
Show Gist options
  • Select an option

  • Save dinks/aad9256bac2d64bb87f9 to your computer and use it in GitHub Desktop.

Select an option

Save dinks/aad9256bac2d64bb87f9 to your computer and use it in GitHub Desktop.
Fix Minutes
# 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