What is the use of super in Ruby Rails?
Submitted by: Administrator► 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
Submitted by: Administrator
► 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
Submitted by: Administrator
Read Online Ruby Job Interview Questions And Answers
Top Ruby Questions
☺ | Interpolation is a very important process in Ruby, comment. |
☺ | Explain about interpolation? |
☺ | Explain about ruby code blocks? |
☺ | Explain about Float, Dig and Max? |
☺ | Explain the difference between nil and false in ruby? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |