Friday, 2 August 2019

Class method calling in ruby?

Class methods:
We can call the class method by using class name.

class MyClass
   def self.my_method
     puts 'i am class method'
  end
end

 
 
MyClass.my_method
output=>
i am class method

No comments:

Post a Comment

Interactor in Rails

What is interactor? Interactor provides a common interface for performing complex user interactions An interactor is a simple, sin...