Ruby

37
1225 reads

March 4, 2013

Information NotHiding


Information is not hidden and can be used anywhere in the program.

21
1240 reads

March 4, 2013

Instance Methods


An instance method is declared inside a class definition and is intended for use by a specific object or ‘instance’ of the class

29
1145 reads

March 4, 2013

Method Call Itself


The method-call itself has nothing to do with the change of the object. You can verify this by running this exxample. This simply passes the num object to the change method and returns it

32
1250 reads

March 4, 2013

Parameter Passing


Most of the time, Ruby methods come with two access points – like the doors into and out of a room. The argument list provides the way in; the return value provides the way out.

21
1263 reads

March 4, 2013

When are 2 Objects Identical?


Program shows that if the 2 objects are equal or not

28
1336 reads

March 4, 2013

Information Hiding


In most modern OOP languages such as Java and C#, encapsulation and informa-tion hiding are not rigorously enforced.

38
1233 reads

March 4, 2013

Loops on Arrays


Learn how to calculate no of elements in an array and how to work with a specific array element.

22
1195 reads

March 4, 2013

Tests for equality: == or equal?


By default (as defined in Ruby’s Kernel module) a test using == re-turns true when both objects being tested are the same object.

36
1289 reads

March 4, 2013

Default Arguments


In some cases, a method may need to be capable of receiving an uncertain number of arguments – say, for example, a method which processes a variable length list of items.

28
1235 reads

March 4, 2013

Concatenation Without Using New Object


Example of the string concatena-tion method, <<, which, just like those methods that end with !, modifies the receiver object without creating a new object