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

404
Views
Definición del método Ruby Sintaxis con & palabra clave
class ExchangeUtil def exchange_to(other_currency, date = Date.current, &) @bank.exchange_with_on(self, other_currency, date, &) end end

¿Cuál es el significado de & en la definición de métodos y llamadas a métodos?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Es una nueva característica en Ruby 3.1: Argumento de bloque anónimo

Es solo un atajo para cuando tiene un argumento de bloque para una función cuyo único propósito es pasar a otra función. La sintaxis anterior para eso habría sido

 class ExchangeUtil def exchange_to(other_currency, date = Date.current, &block) @bank.exchange_with_on(self, other_currency, date, &block) end end

El parámetro &block podría haber tenido cualquier nombre, como &my_block , pero el nombre generalmente no tenía sentido, por lo que lo hicieron "anónimo".

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!