RubyFlow The Ruby and Rails community linklog

The Ruby Module Builder Pattern

Did you know that Ruby has configurable modules? Just subclass the Module class, dynamically define some methods in an initializer, and include an instance of the resulting module in another class. I call this thing a “Module Builder” and I just wrote a long blog post explaining what it’s all about. Ruby’s had this secret up its sleeve for all these years, and most of us never knew about it.

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