From: "dalexj (alex jensen)" Date: 2022-12-14T00:10:07+00:00 Subject: [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/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/