A Few Things to Try

  • Even better profiling. After you do your profiling, see the slow parts of your program, and either make them faster or learn to love them as they are, you probably don’t want to see all of that profiling anymore. But (I hope) you’re too lazy to go back and delete it all…especially because you might want to use it again someday. Modify the profile method so you can turn all profiling on and off by changing just one line of code. Just one word!

  • Grandfather clock. Write a method that takes a block and calls it once for each hour that has passed today. That way, if I were to pass in the block:

    do
    puts 'DONG!'
    end

    it would chime (sort of) like a grandfather clock. Test your method out with a few different blocks.

    Hint: You ...

Get Learn to Program, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.