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

wpf - Line breaks and indenting for the XAML of a saved FlowDocument? -

gtk - Python Window Resize -

c# - read full xml file data over tcp -