aboutsummaryrefslogblamecommitdiffstats
path: root/actionpack/lib/sprockets/compressors.rb
blob: 6544953df4a507ba4a3a8379ba2a036685811327 (plain) (tree)




















                                                       
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