[ruby-core:111277] [Ruby master Feature#19232] add NoMatchingPatternError#matchee

Issue #19232 has been reported by dalexj (alex jensen). ---------------------------------------- Feature #19232: add NoMatchingPatternError#matchee https://bugs.ruby-lang.org/issues/19232 * Author: dalexj (alex jensen) * Status: Open * Priority: Normal ---------------------------------------- currently if you pattern match a Hash, you can inspect the #key and #matchee methods from the NoMatchingPatternKeyError ```ruby begin { error: true } => { value: } rescue NoMatchingPatternKeyError => e e.matchee end # => {:error=>true} ``` I would find it very helpful for this functionality to be available for the standard `NoMatchingPatternError` without hash key matching proposed: ```ruby begin [:error, "message"] => [:ok, value] rescue NoMatchingPatternError => e e.matchee end # => [:error, "message"] ``` -- https://bugs.ruby-lang.org/

Issue #19232 has been updated by ktsj (Kazuki Tsujimoto). Status changed from Open to Feedback Do you have any real use case for this? ---------------------------------------- Feature #19232: add NoMatchingPatternError#matchee https://bugs.ruby-lang.org/issues/19232#change-100892 * Author: dalexj (alex jensen) * Status: Feedback * Priority: Normal ---------------------------------------- currently if you pattern match a Hash, you can inspect the #key and #matchee methods from the NoMatchingPatternKeyError ```ruby begin { error: true } => { value: } rescue NoMatchingPatternKeyError => e e.matchee end # => {:error=>true} ``` I would find it very helpful for this functionality to be available for the standard `NoMatchingPatternError` without hash key matching proposed: ```ruby begin [:error, "message"] => [:ok, value] rescue NoMatchingPatternError => e e.matchee end # => [:error, "message"] ``` -- https://bugs.ruby-lang.org/
participants (2)
-
dalexj (alex jensen)
-
ktsj (Kazuki Tsujimoto)