mame (Yusuke Endoh) wrote in #note-5: > In terms of cognitive complexity, I find it much easier to understand when the logic is written out explicitly, even if it's more verbose, like this: > ... Those who prefer iterative logic over met...Alexander.Senko (Alexander Senko)
matheusrich (Matheus Richard) wrote in #note-3: > I'm sorry, I don't understand the use case, nor how it DRY things up. > ... The idea is a) to **reduce cognitive complexity** by removing one trivial branch of `if`/`else` statement or ...Alexander.Senko (Alexander Senko)
nobu (Nobuyoshi Nakada) wrote in #note-1: > Regarding `respond_to?`, IIRC, isn't ActiveSupport's `try` based on it? Yes, it would be even simpler with Rails: ```ruby @record = Record.find(record_id) .optional { it.try :decorate ...Alexander.Senko (Alexander Senko)
## What When chaining, I need sometimes to apply some changes conditionally, like this: ```ruby @record = Record.find(record_id) .then { it.respond_to?(:decorate) ? it.decorate : it } ``` It would be great to DRY it a bit: `...Alexander.Senko (Alexander Senko)