Class: Modulr::Minifier
- Inherits:
-
Object
- Object
- Modulr::Minifier
- Defined in:
- lib/modulr/minifier.rb
Constant Summary collapse
- YUI_COMPRESSOR_PATH =
File.join(File.dirname(__FILE__), '..', '..', 'vendor', 'yuicompressor-2.4.2.jar').freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Minifier
constructor
A new instance of Minifier.
- #minify(input) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Minifier
Returns a new instance of Minifier.
12 13 14 |
# File 'lib/modulr/minifier.rb', line 12 def initialize( = {}) = end |
Class Method Details
.minify(input, options = {}) ⇒ Object
8 9 10 |
# File 'lib/modulr/minifier.rb', line 8 def self.minify(input, = {}) new().minify(input) end |
Instance Method Details
#minify(input) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/modulr/minifier.rb', line 16 def minify(input) run_yui_compressor do |pipe, stderr| pipe.write(input) pipe.close_write output, error = pipe.read, stderr.read raise MinifierError, error unless error.empty? output end end |