As dire as this situation appears, you are not doomed to accept the dependencies. Just as you would DRY out repetitive code inside of a class, DRY out the creation of new
Gear instances by creating a single method to wrap the external interface. The classes in your application should depend on code that you own; use a wrapping method to isolate external dependencies.
- Chapter 3. Managing Dependencies
- from Practical Object-Oriented Design in Ruby: An Agile Primer
- Publisher: Addison-Wesley Professional
- Released: September 2012
when you can't change the called upon instance
Share this highlighthttp://www.safaribooksonline.com/a/practical-object-oriented-design/70889/