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

  • @user-vp4gu1qx6q
    @user-vp4gu1qx6qАй бұрын

    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.

  • @StupidCodeFactory
    @StupidCodeFactoryАй бұрын

    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

  • @pablomza
    @pablomzaАй бұрын

    line 4: what is that required_options does?

  • @andyjeffries
    @andyjeffriesАй бұрын

    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

    @GorailsTV

    Ай бұрын

    I usually forget it exists

Келесі