Methods

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.

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.

28
1292 reads

March 4, 2013

Protected


The same access rules apply when calling the methods of ancestor and descen-dent objects.

23
1306 reads

March 4, 2013

Overriding Methods


There are times when you may want to redefine a method that already exists in some class.

38
1374 reads

March 4, 2013

Ruby Constructor New


The method responsible for bringing an object into being is called the construc-tor. In Ruby, the constructor method is called new.

26
1256 reads

March 4, 2013

Nested Methods Scope


When you run a method that encloses nested methods, those nested methods will be brought into scope outside that method