Ruby

27
1226 reads

February 28, 2013

Module Variables


Incidentally, that any variables which are local variables in the module cannot be accessed from outside the module.

21
1442 reads

February 28, 2013

Math


The Math module’s methods are provided as both ‘module’ and ‘instance’ methods and can therefore be accessed either by mixing Math into a class or by accessing the module methods ‘from the outside’ by

31
1256 reads

February 28, 2013

Instance Class Variables


instance variables are available to mixed in methods (such as bar).

39
1342 reads

February 28, 2013

Extending Objects


You can add the methods of a module to a specific object (rather than to an entire class) using the extend method

33
1296 reads

February 28, 2013

Name Conflicts


Module methods (those methods specifically preceded by the module name) can help to protect your code from accidental name conflicts.

26
1324 reads

February 28, 2013

Comparable Module


One way of avoiding ambiguity when you use similarly named methods from multiple modules is to ‘alias’ those methods. An alias is a copy of an existing method with a new name.

22
1309 reads

February 28, 2013

Alias Methods


One way of avoiding ambiguity when you use similarly named methods from multiple modules is to ‘alias’ those methods. An alias is a copy of an existing method with a new name.

31
1346 reads

February 28, 2013

Procedures 2


The example shows the concept of procedures.

27
1223 reads

February 28, 2013

Procedures1


The example shows the concept of procedures.

30
1287 reads

February 28, 2013

Precedence


The example demonstrates the concept of precedence of one over other.