Here’s the second refactoring from the Rubyize This workshop. See the first refactoring for an explanation of what’s going on and why this code is so darn ugly! Don’t forget to check out the third and final refactoring
This script loads the file full of random numbers from the first refactoring and makes a beautiful ascii-art histogram from it.
Here’s a very concise one-liner from the crowd:
Here’s Owen’s refactoring:
Here’s Sam Livingstone Gray’s refactoring
I really like this one. Sam created a simple extension to Enumerable that I can see using over and over again.
Here’s what I came up with, with some debugging help from the group