Ruby Programming Language Question:

What is the use of super in Ruby Rails?

Tweet Share WhatsApp

Answer:

► Ruby uses the super keyword to call the superclass implementation of the current method.
► Within the body of a method, calls to super acts just like a call to that original method.
► The search for a method body starts in the superclass of the object that was found to contain the original method.
def url=(addr)
super (addr.blank? || addr.starts_with?('http')) ? addr : http://#{addr}
end

Download Ruby PDF Read All 26 Ruby Questions
Previous QuestionNext Question
Interpolation is a very important process in Ruby, comment.What is the use of load and require in ruby?