Class: Sprockets::JSMincCompressor

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

Constant Summary collapse

VERSION =
'1'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ JSMincCompressor

Returns a new instance of JSMincCompressor.


23
24
25
26
# File 'lib/sprockets/jsminc_compressor.rb', line 23

def initialize(options = {})
  @compressor_class = Autoload::JSMinC
  @cache_key = "#{self.class.name}:#{Autoload::JSMinC::VERSION}:#{VERSION}:#{DigestUtils.digest(options)}".freeze
end

Instance Attribute Details

#cache_keyObject (readonly)

Returns the value of attribute cache_key


21
22
23
# File 'lib/sprockets/jsminc_compressor.rb', line 21

def cache_key
  @cache_key
end

Class Method Details

.cache_keyObject


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

def self.cache_key
  instance.cache_key
end

.call(input) ⇒ Object


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

def self.call(input)
  instance.call(input)
end

.instanceObject


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

def self.instance
  @instance ||= new
end

Instance Method Details

#call(input) ⇒ Object


28
29
30
# File 'lib/sprockets/jsminc_compressor.rb', line 28

def call(input)
  @compressor_class.minify(input[:data])
end