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
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