Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

374
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda