When writing object oriented code, a pretty useful technique is delegation–letting one object figure things out by sending messages to another object.

  • Kache@lemmy.zip
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 month ago

    It’s Ruby. And yes, it could be simpler as a plain, pure function. There is nothing that warrants having the temporary objects, no tricky long-lived state, no leased/shared resource, etc