Ruby

39
1253 reads

March 4, 2013

Assignment


Assignment of a Variable to itself does not create a new object

21
1415 reads

March 4, 2013

Assignment Reference


Simple assignment of one variable to another does not create a new object. So let’s assume you have one variable called num and another called num2.

38
1238 reads

March 4, 2013

Argument Passing


In many procedural programming languages such as Pascal and C and their derivatives there is a clear distinction between arguments passed by value or by reference.

23
1337 reads

March 4, 2013

Singleton Method2


If you think undefined methods are likely to be a problem, you can take avoid-ance measures by testing if a singleton method exists before trying to use it.

40
1208 reads

March 4, 2013

Singleton Method1


look at a concrete example.

36
1242 reads

March 4, 2013

Singleton Class


you might have noticed that the singleton class seems to be doing something rather similar to a singleton method.

27
1447 reads

March 4, 2013

Using Loop


This uses the loop method repeatedly to execute the block enclosed by curly braces. This is just like the iterator blocks

35
1274 reads

March 4, 2013

Singleton Classes


A singleton method is a method which belongs to a single object. A singleton class, on the other hand, is a class which defines a single object. Confused? Me too.

39
1381 reads

March 4, 2013

Cannot Access Private Member Outside the Scope


The whole point of a private method is that it cannot be called from outside the scope of the object to which it belongs. So this won’t work

25
1355 reads

March 4, 2013

Public Protected and Private Access Specifiers


In some cases, you may want to restrict the ‘visibility’ of your methods to ensure that they cannot be called by code outside the class in which the methods occur.