Class: RSpec::Longrun::Formatter::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec/longrun/formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(nested = false) ⇒ Block

Returns a new instance of Block.



106
107
108
109
# File 'lib/rspec/longrun/formatter.rb', line 106

def initialize(nested = false)
  @began_at = Time.now
  @nested = nested
end

Instance Method Details

#finished!Object



111
112
113
# File 'lib/rspec/longrun/formatter.rb', line 111

def finished!
  @finished_at = Time.now
end

#nested!Object



120
121
122
# File 'lib/rspec/longrun/formatter.rb', line 120

def nested!
  @nested = true
end

#nested?Boolean

Returns:

  • (Boolean)


124
125
126
# File 'lib/rspec/longrun/formatter.rb', line 124

def nested?
  @nested
end

#timingObject



115
116
117
118
# File 'lib/rspec/longrun/formatter.rb', line 115

def timing
  delta = @finished_at - @began_at
  '%.2fs' % delta
end