Module: RSpecTelemetry::ConsoleReport::Helpers
- Included in:
- RSpecTelemetry::ConsoleReport
- Defined in:
- lib/rspec_telemetry/console_report.rb
Class Method Summary collapse
Class Method Details
.fmt(ms) ⇒ Object
8 9 10 11 |
# File 'lib/rspec_telemetry/console_report.rb', line 8 def fmt(ms) ms = ms.to_f ms >= 1000 ? format("%.2fs", ms / 1000.0) : format("%.1fms", ms) end |
.pct(ratio) ⇒ Object
13 |
# File 'lib/rspec_telemetry/console_report.rb', line 13 def pct(ratio) = format("%.1f%%", ratio * 100) |
.section(title) ⇒ Object
17 |
# File 'lib/rspec_telemetry/console_report.rb', line 17 def section(title) = ["", title, "-" * title.length] |
.truncate(str, len) ⇒ Object
15 |
# File 'lib/rspec_telemetry/console_report.rb', line 15 def truncate(str, len) = str.length > len ? "#{str[0, len - 1]}…" : str |