[#97678] [Ruby master Feature#16752] :private param for const_set — bughitgithub@...
Issue #16752 has been reported by bughit (bug hit).
5 messages
2020/04/02
[ruby-core:97936] [Ruby master Feature#16796] Assigning local variables when using `case when regexp`
From:
nobu@...
Date:
2020-04-17 08:53:25 UTC
List:
ruby-core #97936
Issue #16796 has been updated by nobu (Nobuyoshi Nakada). It is because `when` calls `===` method but not `=~`. ---------------------------------------- Feature #16796: Assigning local variables when using `case when regexp` https://bugs.ruby-lang.org/issues/16796#change-85160 * Author: UlyssesZhan (有丘 詹) * Status: Open * Priority: Normal ---------------------------------------- I want to use ```ruby case "str" when /s(?<mid>.)r/ p mid end ``` instead of ```ruby case when /s(?<mid>.)r/ =~ "str" p mid end ``` I also do not like using `$1`. This feature is extremely useful when there are a lot of `when`s. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>