Module: Terraspace::Util::Pretty

Included in:
Terraform::Runner::Retryer, Terraspace::Util
Defined in:
lib/terraspace/util/pretty.rb

Instance Method Summary collapse

Instance Method Details

#pretty_path(path) ⇒ Object



14
15
16
17
# File 'lib/terraspace/util/pretty.rb', line 14

def pretty_path(path)
  return path if ENV['TS_TEST']
  path.sub("#{Terraspace.root}/",'').sub(ENV['HOME'], '~')
end

#pretty_time(total_seconds) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/terraspace/util/pretty.rb', line 4

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