Introduction to dependency injection in Ruby
Christian Paling

Tim Case, I think you misunderstood Jamis Buck’s article. He never said DI should never be used in Ruby or that it’s not a useful concept. On the contrary, he actually uses it and encourages it. Here is a direct quote from the article:

So, is there no room for DI in Ruby? There definitely is. I use DI nearly every day in Ruby, but I do not use a DI framework. Ruby itself has sufficient power to represent any day-to-day DI idioms you need. Consider this one:
class A
class B
def new_client(with=A)
Here, B declares a factory method for generating new client objects. Because Ruby lets you declare default values for method arguments, you can let the default client implementation be A, which is the common case. But for testing, you can easily inject a mock into that method by passing an explicit parameter.

That’s one of the ways I use DI in Ruby, and it makes testing a lot easier and cleaner. Here are some more articles about the same concept:

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.