Class: Sprockets::LazyCompressor

Inherits:
Object
  • Object
show all
Defined in:
actionpack/lib/sprockets/compressors.rb

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ LazyCompressor

Returns a new instance of LazyCompressor.



9
10
11
# File 'actionpack/lib/sprockets/compressors.rb', line 9

def initialize(&block)
  @block = block
end

Instance Method Details

#compress(content) ⇒ Object



17
18
19
# File 'actionpack/lib/sprockets/compressors.rb', line 17

def compress(content)
  compressor.compress(content)
end

#compressorObject



13
14
15
# File 'actionpack/lib/sprockets/compressors.rb', line 13

def compressor
  @compressor ||= @block.call || NullCompressor.new
end