[ruby-core:124522] [Ruby Feature#21822] Expose Return Value in the ensure Block
13 Jan
2026
13 Jan
'26
8:03 p.m.
Issue #21822 has been updated by nobu (Nobuyoshi Nakada). Is the variable `nil` if an exception is raised, even for non-local variable? By analogy with `rescue`, it feels natural for me that the variable is unchanged in that case. ---------------------------------------- Feature #21822: Expose Return Value in the ensure Block https://bugs.ruby-lang.org/issues/21822#change-116082 * Author: artemb (Artem Borodkin) * Status: Open ---------------------------------------- I'd like to propose a simple feature that allows easy access to the return value inside an ensure block. ```ruby begin # ... ensure => ret # ret is nil if an exception is raised LOGGER.debug "return value: #{ret}" end ``` -- https://bugs.ruby-lang.org/
52
Age (days ago)
52
Last active (days ago)
0 comments
1 participants
participants (1)
-
nobu (Nobuyoshi Nakada)