1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
module Sprockets class NullCompressor def compress(content) content end end class LazyCompressor def initialize(&block) @block = block end def compressor @compressor ||= @block.call || NullCompressor.new end def compress(content) compressor.compress(content) end end end