SYMBOLS.values_at(str.upcase.chars.to_a)
Regarding using SYMBOLS[]
, you'd still need to pass the character to the method.
You can get the method via SYMBOLS.method(:[])
, e.g.,
> p = SYMBOLS.method(:[])
> p.call("X")
=> 10
I'm not convinced it's the most readable in this case–for me, calling map
and passing in SYMBOLS[]
, while concise and functional, delays understanding what's happening longer than I prefer.