Refactoring Local Variables to Methods In Ruby
Ғылым және технология
► Check out gorails.com?via=yt for Pro episodes and more!
► SaaS business template for Ruby on Rails with built-in features like Payments, Teams, and much more: jumpstartrails.com
► Ruby on Rails hosting with Hatchbox.io: hatchbox.io
► Learn how to add Stripe Payments (with SCA support!) with Ruby on Rails: courses.gorails.com/payments-...
Пікірлер: 5
In the process of extracting the variable into a method, you made an endless method every time. I use endless methods in these cases as they are shorter and, to me, easier to read. I believe endless methods arrived in Ruby 3.0.
I do this all the time :D often memoizing if this calls something expensive to compute, that would have been great to mention this in this video
line 4: what is that required_options does?
You don't use the short Ruby method definition? `def stream = (evaluate_options(:stream) || recipient)` - is this just to maintain backwards compatibility in the gem with older Rails? Or don't like that syntax?
@GorailsTV
Ай бұрын
I usually forget it exists