RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

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!

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/

Comments

Your final method could, in theory, be refactored further:

def where_if(filters, attribute:, parameter: attribute) data = filters[parameter] # etc...

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in