Edgecase has some nice koans for learning Ruby. Going through them is a good refresher for some of the Ruby features you don't use that often, or the parts of Ruby where the principle of least surprise has gotten into the weeds (multiple assignment i'm talking to you).
I wrote mine as a class and did TDD so I have my own test suite, but when I plug it into the koans, all is well. My original solution had a bunch of conditional statements, but some refactoring got rid of most of them. Using modulo was the key. Have a look, feedback is welcome.
No comments:
Post a Comment