Sha256: abc5a1cf973c243d02ae1a1b81ac458e1a14a7e4a668c2cf581d54f4aed93d68

Contents?: true

Size: 383 Bytes

Versions: 1

Compression:

Stored size: 383 Bytes

Contents

module RintCore
  # provides methods to make human readable output.
  module PrettyOutput

private

    def seconds_to_words(seconds)
      [[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map{ |count, name|
        if seconds > 0
          seconds, n = seconds.divmod(count)
          "#{n.to_i} #{name}"
        end
      }.compact.reverse.join(' ')
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rintcore-0.0.5 lib/rint_core/pretty_output.rb