I have an array of hashes, and the values are all float numbers.
What are some good ways in Ruby to convert them all to int?
I have this way right now but wonder what other methods there are that are more elegant or clear:
analytics.map {|e| e.keys.each {|k| e[k] = e[k].to_i}; e}
Update: this is a run of the code:
> @analytics = [{:a => 1.1, :b => 123.456}, {'c' => 765.432}]
=> [{:a=>1.1, :b=>123.456}, {"c"=>765.432}]
> @analytics.map {|e| e.keys.each {|k| e[k] = e[k].to_i}; e}
=> [{:a=>1, :b=>123}, {"c"=>765}]
> @analytics
=> [{:a=>1, :b=>123}, {"c"=>765}]