Class: Shine::JS::Compressor

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

Instance Method Summary collapse

Constructor Details

#initialize(filepaths) ⇒ Compressor

Returns a new instance of Compressor.



128
129
130
# File 'lib/shine.rb', line 128

def initialize(filepaths)
  @filepaths = filepaths
end

Instance Method Details

#compress(options = {}) ⇒ Object



132
133
134
# File 'lib/shine.rb', line 132

def compress(options={})
  Shine.compress_js(@filepaths, options)
end

#compress_in_place(options = {}) ⇒ Object



136
137
138
139
140
141
# File 'lib/shine.rb', line 136

def compress_in_place(options={})
  @filepaths.each do |p|
    c = Shine.compress_js(p, options)
    File.open(p, 'w') { |f| f.write(c) }
  end
end