Ruby Ruby Blocks Working With Blocks Block Method Practice: Custom Classes

Brian Patterson
Brian Patterson
19,585 Points

Not sure what is wrong?

Not sure what is wrong.

simple_benchmarker.rb
class SimpleBenchmarker
  def run(description, &block)
    start_time = Time.now
    block.call
    end_time = Time.now
    elapsed = end_time - start_time

    puts "\n#{description} results"
    puts "Elapsed time: #{elapsed} seconds"
  end
end

1 Answer

Jacob Bergdahl
Jacob Bergdahl
29,118 Points

Brian, you haven't made any changes to the code at all :)

Brian Patterson
Brian Patterson
19,585 Points

Found the answer in the end. Thanks for the reply.