class RSpec::By::Formatter::Bullet

Attributes

message[RW]

Public Class Methods

new(message = '', nested = false) click to toggle source
# File lib/rspec/by/formatter.rb, line 93
def initialize(message = '', nested = false)
  @t0 = RSpec::Core::Time.now
  @nested = nested
  @message = message
end

Public Instance Methods

delta_t() click to toggle source
# File lib/rspec/by/formatter.rb, line 99
def delta_t
  delta_t = RSpec::Core::Time.now - @t0
  format_time(delta_t)
end
format_seconds(float, precision = 2) click to toggle source
# File lib/rspec/by/formatter.rb, line 126
def format_seconds(float, precision = 2)
  #precision ||= (float < 1) ? 5 : 2
  sprintf("%.#{precision}f", float)
end
format_time(duration) click to toggle source
# File lib/rspec/by/formatter.rb, line 116
def format_time(duration)
  if duration > 60
    minutes = duration.to_i / 60
    seconds = duration - minutes * 60
    "#{minutes}m #{format_seconds(seconds)}s"
  else
    "#{format_seconds(duration)}s"
  end
end
nest() click to toggle source
# File lib/rspec/by/formatter.rb, line 108
def nest
  @nested = true
end
nested?() click to toggle source
# File lib/rspec/by/formatter.rb, line 112
def nested?
  @nested
end
offset() click to toggle source
# File lib/rspec/by/formatter.rb, line 104
def offset
  @message.size
end