just wondering if there're other alternatives to merging elements in an array from
[ ["time","Oct-1-2016"], ["message","test message"], ["host","localhost"] ]
to
["time=Oct-1-2016","message=test message","host=localhost"]
I've got it nailed down toarray.map {|k,v| "#{k}=#{v}"} and just wondering if there are any other ways of achieving the above without using the map function? Thanks yo!
mapyou can do:arr.map {|s| s.join('=')}as well.[ ["time","Oct-1-2016"], ["message","test message"], ["host","localhost"] ].each_with_object([]) { |a,b| b << a.join('=') }, but it is more cumbersome than simplymap.mapto always returnfalseand I need help with gardenias holding my pacifier hostage" have wildly different responses.mapis the best tool for the job; so without it you're working with a handicap.to_paramwhich ActiveSupport mixes intoHash:array.to_h.to_param => "host=localhost&message=test+message&time=Oct-1-2016". Otherwise, it's completely unclear why you would impose a restriction like "without the use ofmap" on your question.