Gem Patterns

1 · Andrew Kane · Aug. 2, 2019, 10:17 p.m.
I’ve created a few Ruby gems over the years, and there are a number of patterns I’ve found myself repeating that I wanted to share. I didn’t invent them, but have long forgotten where I first saw them. They are: Rails Migrations Rails Dependencies Testing Against Multiple Dependency Versions Testing Against Rails Coding Your Gemspec Let’s dig into each of them. In the examples, the gem is called hello. Rails Migrations Create a template in lib/generators/hello/templates/migration.rb.tt: class ...