Time to Get My Ruby On
I finally completed all the exercises for the Ruby course on Codeacademy!
I should have finished it sooner but got sidetracked by life. Now it's time to move on to the next part and actually build a script.
It was a decent experience using Codeacademy. They explained each part when going through the course and had hints to help you through it. I admit I was completely lost a few times and took me a while to figure out how to do some of the exercises even though they give you the answer after so many failed attempts. I would keep trying before I eventually gave up and looked at the answer.
One of the last sections towards the end went over object-oriented programming that can mix module methods at the class level using extend
. This means that class itself can use the methods, as opposed to instances of the class.
module ThePresent
def now
puts "It's #{Time.new.hour > 12 ? Time.new.hour - 12 : Time.new.hour}:#{Time.new.min} #{Time.new.hour > 12 ? 'PM' : 'AM'} (GMT)."
end
end
class TheHereAnd
extend ThePresent
end
TheHereAnd.now
There a lot more I need to learn and will probably have to go back and go over the course since I have a terrible memory but at least I know a little bit more when it comes to reading some code.
I need to get back to studying so I can get my Ruby on :P
Image Source