Module: HtmlPress

Defined in:
lib/troy/hacks.rb

Class Method Summary collapse

Class Method Details

.content_cacheObject



6
7
8
# File 'lib/troy/hacks.rb', line 6

def self.content_cache
  @content_cache ||= {}
end

.js_compressor(text, options = nil) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/troy/hacks.rb', line 10

def self.js_compressor(text, options = nil)
  options ||= {}
  options[:output] ||= {inline_script: true}

  hash = Digest::SHA1.hexdigest(text)
  content_cache[hash] ||= MultiJs.compile(text, options).gsub(/;$/, "")
  content_cache[hash]
end