Module: Buildkite::Builder::LoggingUtils
- Included in:
- Commands::Run, ExtensionManager, Pipeline
- Defined in:
- lib/buildkite/builder/logging_utils.rb
Instance Method Summary collapse
Instance Method Details
#benchmark(output, &block) ⇒ Object
8 9 10 11 |
# File 'lib/buildkite/builder/logging_utils.rb', line 8 def benchmark(output, &block) time = Benchmark.realtime(&block) output % [pluralize(time.round(2), 'second')] end |
#pluralize(count, singular, plural = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/buildkite/builder/logging_utils.rb', line 13 def pluralize(count, singular, plural = nil) if count == 1 "#{count} #{singular}" elsif plural "#{count} #{plural}" else "#{count} #{singular}s" end end |