By defining a method with def method_name args , you define an instance method that will be included in every object of this class, but not in the class itself.
On the other hand, with def self.method_name args you get a class method that will be directly in the class, without having to run an object from it.
So, if you have this:
Class Test def self.bar end def foo end end
You can execute the instance method as follows:
a = Test.new a.foo
As for the class, you need:
Test.foo
source share