important topic on ruby code example

Example: important topic on ruby

1.You can use ruby modules as mixins where your design requires multiple inheritance
2.Every method returns the value of its last statement as the value of the method though you can use return where you want to be more explicit.
3.You can open any class again and add methods to it, called monkey patching which can be very powerful if used sensibly otherwise hell will break.
4.You can pass a block of code to any method and operate on it, e.g. in ruby world most of the time coders use iterators instead of for loops.
5.Where possible use symbols instead of strings because they are efficient, e.g. in hash keys
etc..

Tags:

Misc Example