You can do this:
Hash[ preferences.map {|k,v| [k.to_sym, v.nonzero? or false]} ]
This preserves the value if it is nonzero.
Code review
Note that when you initialize a return variable and then loop over another variable, e.g.
hsh = {}
preferences.each do
#something that updates hsh
end
A more idiomatic Ruby way to do this is with a map
, as the answers show. This will in general result in more concise, expressive code.