This does, in a sense, conflate Symbol and String keys, but String keys are impossible in pattern matching:
CSV::Row.new(%w(AB),[1,2],true)in "A" => 1/Users/lemur/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/irb/workspace.rb:119:in `eval': (irb):14: syntax error, unexpected integer literal, expecting local variable or method (SyntaxError)...A B), [1, 2], true) in "A" => 1
So the options are either have an interface which will only work with test data and users who manually create Symbol keys (which is a minority case), or consider a keyword-like approach that can handle the ambiguity of keys types.
I believe this is a reasonable assumption of coercion to make, as Ruby has done this in other cases with converting between Symbol and String whenever it is considered reasonable input from the user. I believe this would qualify as reasonable user input.
If this is of interest I can submit a PR, but wanted to run the idea by people first.
The text was updated successfully, but these errors were encountered: