This blog no longer exists.
You will be redirected to something cool.

Friday, May 6, 2011

Breaking Ruby code up into methods

I wanted to try out RSpec so that I could more easily test my Ruby code, but had to break it up into methods. Going from this code to something nice and easy to test with RSpec was very difficult for me as I still have problems writing methods. After receiving help on StackOverflow on how to set up the methods, I was able to fill in the blank spots. While I'm not really "on my own" with writing methods, this was definitely a good exercise in getting me where I want to be with that.

In the same night, I was able to figure out how to use RSpec with the nice, clean Ruby code and to get my project up on GitHub. I still will have challenges ahead in writing methods as well as writing my specs BEFORE writing my Ruby code. Git also will throw a few curveballs at me as I continue to learn to use it. While difficult for me to really understand right now, RSpec is already helpful and Git is a godsend.

Here is the code after breaking it up into methods. Later I will show all of what I completed in a post about RSpec.