Sha256: de98ff1ee8f4fb99420b1e5d12e5252621fa3e7e167c11bf4f9c4c02472fde6d

Contents?: true

Size: 620 Bytes

Versions: 33

Compression:

Stored size: 620 Bytes

Contents

module Ufo::Utils
  module Pretty
    def pretty_path(path)
      path.sub("#{Ufo.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

33 entries across 33 versions & 1 rubygems

Version Path
ufo-6.3.13 lib/ufo/utils/pretty.rb
ufo-6.3.12 lib/ufo/utils/pretty.rb
ufo-6.3.11 lib/ufo/utils/pretty.rb
ufo-6.3.10 lib/ufo/utils/pretty.rb
ufo-6.3.9 lib/ufo/utils/pretty.rb
ufo-6.3.8 lib/ufo/utils/pretty.rb
ufo-6.3.7 lib/ufo/utils/pretty.rb
ufo-6.3.6 lib/ufo/utils/pretty.rb
ufo-6.3.5 lib/ufo/utils/pretty.rb
ufo-6.3.4 lib/ufo/utils/pretty.rb
ufo-6.3.3 lib/ufo/utils/pretty.rb
ufo-6.3.2 lib/ufo/utils/pretty.rb
ufo-6.3.1 lib/ufo/utils/pretty.rb
ufo-6.3.0 lib/ufo/utils/pretty.rb
ufo-6.2.5 lib/ufo/utils/pretty.rb
ufo-6.2.4 lib/ufo/utils/pretty.rb
ufo-6.2.3 lib/ufo/utils/pretty.rb
ufo-6.2.2 lib/ufo/utils/pretty.rb
ufo-6.2.1 lib/ufo/utils/pretty.rb
ufo-6.2.0 lib/ufo/utils/pretty.rb