Code should be as declarative as possible (usually by using [functional style][1]):

    def transform
      special_values = {"1" => true, "0" => 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][2], so I'd really write `preferences.mash { |k, v| [k.to_sym, special_values.fetch(v, v)] }`.


  [1]: https://code.google.com/p/tokland/wiki/RubyFunctionalProgramming
  [2]: http://rdoc.info/github/rubyworks/facets/master/Enumerable#graph-instance_method