Archive for March 18th, 2008
$0 , __FILE__
$0 is the file which load any other ruby file which is contained in __FILE__….
Read Full Post | Make a Comment ( None so far )Splat Operator in Ruby
* is called the splat operator in ruby .The first time you come across is for variable argument.that is exactly what you will be using it for.it should be used as the last argument.
name,*rest_of_address = address[]
would put the first argument to name and rest to the * argument…
THe other thing about it is it gives [...]
Structures in Ruby
If you wanted just a storage variable in terms of big structure with no code on them .The best way is to call Struct.new followed by what ever structure fields you want on them.Once the structure is created you can create a new on it by just calling the name of the Structure .new [...]
Read Full Post | Make a Comment ( None so far )