ruby - How to get the size of each value of a hash -
I have hashes, each value is an array.
I have a new array of each value / size of the array.
Example:
hash
{"A" => ["1", "2", "3"], "b" = & gt; ["B", "break"]}
results
[3, 2]
help you Thanks for
some_hash Values.map {| V | | V.size}
and 1.9, I believe you can do this:
some_hash.values.map (and size: )
Comments
Post a Comment