Class: Packr::Engine

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

Instance Method Summary collapse

Constructor Details

#initializeEngine

Returns a new instance of Engine.



4
5
6
7
8
9
# File 'lib/packr/engine.rb', line 4

def initialize
  @minifier = Minifier.new
  @shrinker = Shrinker.new
  @privates = Privates.new
  @base62   = Base62.new
end

Instance Method Details

#pack(script, options = {}) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/packr/engine.rb', line 11

def pack(script, options = {})
  script = @minifier.minify(script)
  script = @shrinker.shrink(script, options[:protect]) if options[:shrink_vars]
  script = @privates.encode(script) if options[:private]
  script = @base62.encode(script) if options[:base62]
  script
end