Class: Medbay::Test
- Inherits:
-
Object
- Object
- Medbay::Test
- Defined in:
- lib/medbay/test.rb
Instance Attribute Summary collapse
-
#func ⇒ Object
Returns the value of attribute func.
-
#label ⇒ Object
Returns the value of attribute label.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(label, func) ⇒ Test
constructor
A new instance of Test.
Constructor Details
#initialize(label, func) ⇒ Test
Returns a new instance of Test.
5 6 7 8 |
# File 'lib/medbay/test.rb', line 5 def initialize(label, func) @label = label @func = func end |
Instance Attribute Details
#func ⇒ Object
Returns the value of attribute func.
3 4 5 |
# File 'lib/medbay/test.rb', line 3 def func @func end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'lib/medbay/test.rb', line 3 def label @label end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/medbay/test.rb', line 10 def call passed, elapsed = nil if Medbay.configuration.benchmark elapsed = Benchmark.realtime do passed = @func.call end return {passed: passed, name: @label, elapsed: elapsed*1000} end passed = @func.call {passed: passed, name: @label} end |