module Whipped def cost super + 0.2 endendmodule Sprinkles def cost super + 0.3 endendclass Coffee def self.with(*args) args.inject(self.new) {|memo, val| memo.extend val} end def cost 2 endendx = Coffee.with Sprinkles, Whippedx.cost