rails/rails — pull request #8471 by kytrinyx (2012-12-09 23:47:12+00:00)
Title: WIP Refactor xml conversion to hash

Hash.from_xml was very complicated, and so we decided to take a stab at
refactoring it. This is a work in progress that we want to get feedback on.

Basically, instead of defining a huge method on Hash, we made a utility
object for actually doing the conversion. This let us break up the big
method into a bunch of smaller ones, so that the process overall is
easier to understand.

However, some of the names kinda suck. Still working on that. But we
wanted to get some feedback on if this kind of change is generally
considered to be better or not before putting more effort into
breaking it up. We think that a bunch of small methods are easier to understand
than one massive one.

Things to work on:

* Names. {process,convert} is awkward. And there's also typecast/to.
* Might be another utility object as well, as half of the class is for refining
a Hash that's getting converted.
* We may have uncovered either missing test cases or extraneous conditions
in a few of the if statements. We've left some comments. Tests pass if
you remove them, but we didn't want to before confirming that they
aren't actually needed.
* Changes to documentation, including # :nodoc: where appropriate

- @steveklabnik & @kytrinyx