Posts under Ruby

Overriding the Private Method of a Ruby Class

It feels like forever since I ever posted anything, but, here I am with an interesting post on ruby! Consider the following class which has a private method called “say”. class Client def print say end private def say “hello” end end c = puts c.print Let’s assume you are unit testing the Client [...]

Yet Another Ruby Language Post :)

This time, I am back with a post that deals with few interesting aspects of ruby. To begin with, I am going to discuss about YAML (Guess you now know the reason why I gave this title to this post ). YAML is an acronym for Yet Another Markup Language. YAML is a way by [...]

More ruby bits

It’s ruby time again! Just for fun (or may be it’s useful) I wanted to create a class that holds a list of similar objects. I wrote this class based on the following requirements: Should enable the user to specify the type the list will hold during initialization Should be able to hold an arbitrary [...]

Ruby bits

Okay, in this post I am going to discuss some interesting bits of ruby. To begin with, this is a very useful feature that you could utilize in ruby, in case you are writing a mini language based on certain rules for yourself. Let us assume you need to split string in to tokens. Yes this [...]

Some ruby love! – method_missing

Okay, time for some ruby love At this point, ruby gets the first place among my favorite dynamic languages! In this post I would like to discuss some interesting ruby facts I learned recently. First post is about method_missing. method_missing is a special method in ruby that can be used to handle calls to non-existent [...]