Class: Crush::YUI::JavaScriptCompressor

Inherits:
Engine
  • Object
show all
Defined in:
lib/crush/yui.rb

Overview

Engine implementation the YUI JavaScript compressor. See:

rubygems.org/gems/yui-compressor

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Engine

compile, compress, #compress, #initialize, #render

Constructor Details

This class inherits a constructor from Crush::Engine

Class Method Details

.engine_initialized?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/crush/yui.rb', line 12

def self.engine_initialized?
  !!(defined?(::YUI) && defined?(::YUI::JavaScriptCompressor))
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



25
26
27
# File 'lib/crush/yui.rb', line 25

def evaluate(scope, locals, &block)
  @output ||= @engine.compress(data)
end

#initialize_engineObject



16
17
18
# File 'lib/crush/yui.rb', line 16

def initialize_engine
  require_template_library "yui/compressor"
end

#prepareObject



20
21
22
23
# File 'lib/crush/yui.rb', line 20

def prepare
  @engine = ::YUI::JavaScriptCompressor.new(options)
  @output = nil
end