def name(name) recipe.name = name end def difficulty(difficulty) recipe.difficulty = difficulty end def ingredient(ingredient) recipe.add_ingredient(ingredient) end end
def name(name) recipe.name = name end def difficulty(difficulty) recipe.difficulty = difficulty end def ingredient(ingredient) recipe.add_ingredient(ingredient) end end
@recipe = Recipe.new end def method_missing(method_name, *args) if DELEGATED_SETTERS.include?(method_name) recipe.send("#{method_name}=", *args) # e.g.: name=("spaghetti con polpette") else super end end def ingredient(ingredient) recipe.add_ingredient(ingredient) end end