From: Dorren Date: 2007-01-25T07:45:12+09:00 Subject: can it be shorter? doing access control on rails controller, ------ I have this input -------------- hash = {"index" => "list", ["edit", "update"] => "manage_one", ["new", "create", "destroy"] => "manage_all"} ------- I want this output ---------- {"index"=>"list", "edit"=>"manage_one", "update"=>"manage_one", "new"=>"manage_all", "create"=>"manage_all", "destroy"=>"manage_all" } ------ I have this code ------------ hash = Hash[*hash.to_a.collect{|x| Array === x[0] ? x[0].zip([x[1]]*x[0].size) : x }.flatten] ----- I want shorter code ------ thanks.