Ruby获取所有键或哈希值
示例
{foo: 'bar', biz: 'baz'}.keys # => [:foo, :biz]{foo: 'bar', biz: 'baz'}.values # => ["bar", "baz"]
{foo: 'bar', biz: 'baz'}.to_a # => [[:foo, "bar"], [:biz, "baz"]]
{foo: 'bar', biz: 'baz'}.each #<Enumerator: {:foo=>"bar", :biz=>"baz"}:each>
以上是 Ruby获取所有键或哈希值 的全部内容, 来源链接: utcz.com/z/315789.html