Class: Sprockets::LazyCompressor

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

Instance Method Summary (collapse)

Constructor Details

- (LazyCompressor) initialize(&block)

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

- (Object) compress(content)



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

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

- (Object) compressor



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

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