The style ClassName.method_name versus self.method_name to define class method : self « Class « Ruby






The style ClassName.method_name versus self.method_name to define class method



class Square
  def Square.test_method
    puts "Hello from the Square class!"
  end
end

 








Related examples in the same category

1.self represents the current class,