有什么很棒的代码可以去掉这里的笨重代码吗?
hash = {}
hash["permission_type"] = "some permission type"
hash["vaue"] = "some value"
permission_collection = [] << hash
最佳答案
permission_collection = [ {"permission_type" => "some permission type", "vaue" => "some value"} ]
关于ruby-on-rails - Ruby one liner 替换大块代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21389384/