Refactoring Filters
Recently I was working on refactoring some unwieldy code for filtering data. Here’s a short story of how it went: https://tejasbubane.github.io/posts/2021-01-17-refactoring-filters/
Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!
Recently I was working on refactoring some unwieldy code for filtering data. Here’s a short story of how it went: https://tejasbubane.github.io/posts/2021-01-17-refactoring-filters/
Comments
Your final method could, in theory, be refactored further:
def where_if(filters, attribute:, parameter: attribute) data = filters[parameter] # etc...
Post a comment