|
|
|
|
|
by jonnytran
1953 days ago
|
|
> You must pass it as a symbol in Ruby and then send to it. This is just plain wrong. You can absolutely do this, as other commenters have pointed out. It is common to see Ruby code passing around a symbol and sending it, but my guess as to why this pattern became common is that it can be serialized into plaintext like YAML, stored in a database, and called later, like for a background job in a web app. But there's no need to do it this way. Another reason you don't tend to see it this way in Ruby is because Ruby optimizes for the common case: calling methods [1]. Because of this, you can easily create very concise DSLs in Ruby, which would never be quite as clean in Python. 1: https://yehudakatz.com/2010/02/21/ruby-is-not-a-callable-ori... |
|