Ruby - Class Methods and Variables
Which of the following is the correct way to define a class method in Ruby?
def self.method_name inside the class.def self.method_name, which is correct. def method_name; end defines an instance method. def @method_name; end uses invalid syntax. def class.method_name; end is incorrect syntax.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions