如何使用已具有值的键在Hash对象中追加值.所以,例如,如果我有
>> my_hash = Hash.new
>> my_hash[:my_key] = "Value1"
# then append a value, lets say "Value2" to my hash, using that same key "my_key"
# so that it can be
>> my_hash[:my_key]
=> ["Value1", "Value2"]
Run Code Online (Sandbox Code Playgroud)
我知道编写自己的方法很容易,但我只是想知道是否有内置方法.
ruby ×1