Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

372
Views
Which ruby methods/keywords behave differently depending on whether parentheses are used?

I thought it was kinda cool that super and super() offer different behaviours, with the latter calling the parent method without passing it arguments.

This is the first case I'm aware of of a ruby method/keyword that behaves differently depending on whether the () are included (more on that here).

Are there any other methods/keywords in the ruby programming language which exhibit different behaviour depending on whether the () are included?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

It is impossible for a Ruby method to know what syntax was used for the message send, therefore, a method cannot possibly behave different depending on whether or not the message send includes ().

over 4 years ago · Santiago Trujillo Report

0

Methods in Ruby behave same whether you use parenthesis or not. According to the Ruby style guide, you can omit parenthesis after a method call when you don't pass any arguments. It's true that some Ruby programmers liberally omit parenthesis but this will not make their methods behave differently.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!