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.



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

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

Instance Method Details

#finished! ⇒ Object



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

def finished!
  @finished_at = Time.now
end

#nested! ⇒ Object



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

def nested!
  @nested = true
end

#nested? ⇒ Boolean

Returns:

  • (Boolean)


128
129
130
# File 'lib/rspec/longrun/formatter.rb', line 128

def nested?
  @nested
end

#timing ⇒ Object



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

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