kytrinyx/approvals — pull request #35 by markijbema (2014-02-16 18:45:31+00:00)
Title: WIP: Refactor filters

I made this branch for two reasons:

* I found the original code hard to follow
* I think it's not logical that this logic is available for json, but not for hashes

And a third and fourth reason appeared while refactoring:

* This might be a bit faster, if you have the same key a lot of times (though I don't think it's very important ;) )
* I think the logic is improved by making it non-modifying (though this probably is a slight performance loss)

Therefore I wanted to extract the logic to do the key sanitizing to a class.

As is clear, this is work in progress, so please don't merge ;)

I was wondering why I would need to place such a class. It's not immediately clear to me where in the directory structure this should belong.

One thing I noticed is that the last matching expression is taken. Is this for a specific reason? I think I would find the first a bit more logical, and it allows for (a tiny bit) faster code as well.

Anyways, at this point feedback would be appreciated :) I'm more than happy to finish this, if I know where this should go.