Class: KnapsackPro::Presenter
- Inherits:
-
Object
- Object
- KnapsackPro::Presenter
- Defined in:
- lib/knapsack_pro/presenter.rb
Class Method Summary collapse
Class Method Details
.global_time ⇒ Object
4 5 6 7 |
# File 'lib/knapsack_pro/presenter.rb', line 4 def global_time global_time = pretty_seconds(KnapsackPro.tracker.global_time) "Global time execution for tests: #{global_time}" end |
.pretty_seconds(seconds) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/knapsack_pro/presenter.rb', line 9 def pretty_seconds(seconds) sign = '' if seconds < 0 seconds = seconds*-1 sign = '-' end return "#{sign}#{seconds}s" if seconds.abs < 1 time = Time.at(seconds).gmtime.strftime('%Hh %Mm %Ss') time_without_zeros = time.gsub(/00(h|m|s)/, '').strip sign + time_without_zeros end |