Sha256: 7b91933be49f527384d9df0e3a89a4ea403b98c2bcea7cf66ae95daded80757c

Contents?: true

Size: 623 Bytes

Versions: 4

Compression:

Stored size: 623 Bytes

Contents

module Jets::Util
  module Pretty
    def pretty_path(path)
      path.sub("#{Jets.root}/", "").sub(/^\.\//, "")
    end

    # Replace HOME with ~ - different from the main pretty_path
    def pretty_home(path)
      path.sub(ENV["HOME"], "~")
    end

    # 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

4 entries across 4 versions & 1 rubygems

Version Path
jets-6.0.5 lib/jets/util/pretty.rb
jets-6.0.4 lib/jets/util/pretty.rb
jets-6.0.3 lib/jets/util/pretty.rb
jets-6.0.2 lib/jets/util/pretty.rb