Ruby modules and extend self -


In what sort of code the code is:

  Module M extends the DF greetings itself "Hello" and end  

Use something more beneficial to use:

  Module M def self.greet puts "hello" end of end  

On the top, one example example is being expanded, and later only there is a class method, but when you call any method, then you have to make an M. graph Hoog , Is not it? I was just curious if someone could put some light on another using a code thanks!

The first example is usually a way for people to get the functionality of module_function (When they do not know the existence of this method).

A module_function is both an example method and a class method. The method in your second code example is just a class method.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -