Files

Class/Module Index [+]

Quicksearch

RSpec::Core::Formatters::Helpers

Public Instance Methods

format_seconds(float) click to toggle source
# File lib/rspec/core/formatters/helpers.rb, line 9
def format_seconds(float)
  precision ||= (float < 1) ? SUB_SECOND_PRECISION : DEFAULT_PRECISION
  formatted = sprintf("%.#{precision}f", float)
  strip_trailing_zeroes(formatted)
end
strip_trailing_zeroes(string) click to toggle source
# File lib/rspec/core/formatters/helpers.rb, line 15
def strip_trailing_zeroes(string)
  stripped = string.sub(/[^1-9]+$/, '')
  stripped.empty? ? "0" : stripped
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.