Sha256: 009c6e2ca4d83287c2b402407b6b833874cab031d99b56281cbd8bb25023ca1a

Contents?: true

Size: 407 Bytes

Versions: 29

Compression:

Stored size: 407 Bytes

Contents

module Lono::Utils
  module PrettyTime
    # http://stackoverflow.com/questions/4175733/convert-duration-to-hoursminutesseconds-or-similar-in-rails-3-or-ruby
    def pretty_time(total_seconds)
      minutes = (total_seconds / 60) % 60
      seconds = total_seconds % 60
      if total_seconds < 60
        "#{seconds.to_i}s"
      else
        "#{minutes.to_i}m #{seconds.to_i}s"
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
lono-7.5.2 lib/lono/utils/pretty_time.rb
lono-7.5.1 lib/lono/utils/pretty_time.rb
lono-7.5.0 lib/lono/utils/pretty_time.rb
lono-7.4.11 lib/lono/utils/pretty_time.rb
lono-7.4.10 lib/lono/utils/pretty_time.rb
lono-7.4.9 lib/lono/utils/pretty_time.rb
lono-7.4.8 lib/lono/utils/pretty_time.rb
lono-7.4.7 lib/lono/utils/pretty_time.rb
lono-7.4.6 lib/lono/utils/pretty_time.rb
lono-7.4.5 lib/lono/utils/pretty_time.rb
lono-7.4.4 lib/lono/utils/pretty_time.rb
lono-7.4.3 lib/lono/utils/pretty_time.rb
lono-7.4.2 lib/lono/utils/pretty_time.rb
lono-7.4.1 lib/lono/utils/pretty_time.rb
lono-7.4.0 lib/lono/utils/pretty_time.rb
lono-7.3.2 lib/lono/utils/pretty_time.rb
lono-7.3.1 lib/lono/utils/pretty_time.rb
lono-7.3.0 lib/lono/utils/pretty_time.rb
lono-7.2.3 lib/lono/utils/pretty_time.rb
lono-7.2.2 lib/lono/utils/pretty_time.rb