Module: Ufo::Utils::Pretty

Instance Method Summary collapse

Instance Method Details

#pretty_home(path) ⇒ Object

Replace HOME with ~ - different from the main pretty_path



8
9
10
# File 'lib/ufo/utils/pretty.rb', line 8

def pretty_home(path)
  path.sub(ENV['HOME'], '~')
end

#pretty_path(path) ⇒ Object



3
4
5
# File 'lib/ufo/utils/pretty.rb', line 3

def pretty_path(path)
  path.sub("#{Ufo.root}/",'').sub(/^\.\//,'')
end

#pretty_time(total_seconds) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/ufo/utils/pretty.rb', line 13

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