Class: Iterm2TabFormatter::TextFormatter
- Inherits:
-
Object
- Object
- Iterm2TabFormatter::TextFormatter
- Defined in:
- lib/iterm2_tab_formatter/text_formatter.rb
Instance Method Summary collapse
- #duration ⇒ Object
- #finished_at ⇒ Object
-
#initialize(options) ⇒ TextFormatter
constructor
A new instance of TextFormatter.
- #status ⇒ Object
- #window_title ⇒ Object
Constructor Details
#initialize(options) ⇒ TextFormatter
Returns a new instance of TextFormatter.
6 7 8 |
# File 'lib/iterm2_tab_formatter/text_formatter.rb', line 6 def initialize() @options = .dup end |
Instance Method Details
#duration ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/iterm2_tab_formatter/text_formatter.rb', line 26 def duration text_minutes = (duration_seconds / 60).to_i text_seconds = (duration_seconds % 60) text = '' text << "#{text_minutes}m" if text_minutes > 0 text << ("%.1fs" % text_seconds) text end |
#finished_at ⇒ Object
22 23 24 |
# File 'lib/iterm2_tab_formatter/text_formatter.rb', line 22 def finished_at finish_time.iso8601 end |
#status ⇒ Object
37 38 39 |
# File 'lib/iterm2_tab_formatter/text_formatter.rb', line 37 def status failure_count == 0 ? 'PASS' : 'FAIL' end |
#window_title ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/iterm2_tab_formatter/text_formatter.rb', line 10 def window_title window_title = "#{example_count} example" window_title << 's' unless example_count == 1 window_title << ", #{failure_count} failure" if failure_count > 0 window_title << 's' if failure_count > 1 window_title << ", #{pending_count} pending" if pending_count > 0 window_title end |