March 7, 2016Improve Your Ruby with the Adapter Design Pattern Imagine we have some code where we want to accomplish things in a variety of ways. One way to do this is with conditional branching: class Animal def speak(kind) puts case kind when :dog then "woof!" when :cat then "meow!" when :owl then "hoo!" end end end Animal.new.speak(:dog) This works, but what if a developer wants to add a new wa
{{#tags}}- {{label}}
{{/tags}}