Skip to content

Instantly share code, notes, and snippets.

@gbpereira
Last active January 10, 2018 01:49
Show Gist options
  • Save gbpereira/7adc618bd121c113567c to your computer and use it in GitHub Desktop.
Save gbpereira/7adc618bd121c113567c to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
if ARGV.length >= 2
h, m = 0, 0
ARGV.each do |e|
h += e.split(':').first.to_i
m += e.split(':').last.to_i
end
h += (m / 60).to_i
m = m % 60
puts 'Total: %02d:%02d.' % [h, m]
else
puts 'Você precisa passar pelo menos dois argumentos.'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment