Last Updated: February 25, 2016
·
179
· dinks

Fix Hours

From this great post 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