我试图了解
Ruby / Rails中的依赖注入.如何使用依赖注入删除Builders对Saw的显式引用?
class Builder attr_reader :saw def saw @saw ||= Saw.new(4) end def cut_wood Saw.saw end end class Saw attr_reader :blades def initialize(blades) @blades = blades end def saw # do something end end