Class: Crush::Packr

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

Overview

Engine implementation of Dean Edwards’ JavaScript compressor, Packr. See:

rubygems.org/gems/packr

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)


11
12
13
# File 'lib/crush/packr.rb', line 11

def self.engine_initialized?
  !!(defined? ::Packr)
end

Instance Method Details

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



23
24
25
# File 'lib/crush/packr.rb', line 23

def evaluate(scope, locals, &block)
  @output ||= ::Packr.pack(data, options)
end

#initialize_engineObject



15
16
17
# File 'lib/crush/packr.rb', line 15

def initialize_engine
  require_template_library "packr"
end

#prepareObject



19
20
21
# File 'lib/crush/packr.rb', line 19

def prepare
  @output = nil
end