module HtmlPress

Public Class Methods

content_cache() click to toggle source
# File lib/troy/hacks.rb, line 6
def self.content_cache
  @content_cache ||= {}
end
js_compressor(text, options = nil) click to toggle source
# 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