From: anamma06@... Date: 2018-05-11T09:57:48+00:00 Subject: [ruby-core:86991] [Ruby trunk Feature#14249] Remove str[match_str] Issue #14249 has been updated by ana06 (Ana Maria Martinez Gomez). My example in the first comment is not really correct (something went wrong when copying). What I meant: ~~~ ruby params = { "user" => { "name" => "Nicolas Cage", "age" => 27 } } params["user"]["age"] #=> 27 params = { "user" => "Nicolas Cage" } params["user"]["age"] #=> "age" ~~~ @naruse using dig works nicely for this case, but then the question is if it makes sense to keep `str[match_str]`. It is a confusing method... ---------------------------------------- Feature #14249: Remove str[match_str] https://bugs.ruby-lang.org/issues/14249#change-71954 * Author: ana06 (Ana Maria Martinez Gomez) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- I wonder if `str[match_str]` makes sense. ``` Ruby "ana"['a'] => "a" ``` I would say this is not expected and it brings problems, for example when accessing nested hashes. For example: ``` Ruby params = { "user" => "Nicolas Cage" } => {"user"=>"Nicolas Cage"} params["user"]["age"] => "age" ``` I think `str[regexp]` is enough and that `str[match_str]` can be removed. -- https://bugs.ruby-lang.org/ Unsubscribe: