Manipulate Hash to typecast true/false for certain values
Code should be as declarative as possible (usually by using functional style):

def transform
  special_values = {"1" =&gt; true, "0" =&gt; false}
  Hash[preferences.map { |k, v| [k.to_sym, special_values.fetch(v, v)] }]
end


However, Hash[...] is very ugly and I prefer a more OOP approach with Enumerable#mash, so I'd really write preferences.mash { |k, v| [k.to_sym, special_values.fetch(v, v)] }.