Skip to content

Instantly share code, notes, and snippets.

@k41n3w
Created December 31, 2023 18:27
Show Gist options
  • Save k41n3w/321187df8d23be2c5b9665e4a18894df to your computer and use it in GitHub Desktop.
Save k41n3w/321187df8d23be2c5b9665e4a18894df to your computer and use it in GitHub Desktop.
Código 12 - Post de 'Passagem de parâmetros em Ruby"
def with_logging
puts "Iniciando operação…"
yield
puts "Operação concluída."
end
with_logging do
puts "Realizando a operação…"
end
# Retorno:
# Iniciando operação…
# Realizando a operação…
# Operação concluída.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment