class OptimizeJS::SprocketsProcessor

Sprockets 2, 3 & 4 interface github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#registering-all-versions-of-sprockets-in-processors

Public Class Methods

call(input) click to toggle source
# File lib/optimize-js/sprockets-processor.rb, line 21
def call(input)
  filename = input[:filename]
  source   = input[:data]
  context  = input[:environment].context_class.new(input)

  result = run(filename, source, context)
  context.metadata.merge(data: result)
end
new(filename, &block) click to toggle source
# File lib/optimize-js/sprockets-processor.rb, line 7
def initialize(filename, &block)
  @filename = filename
  @source   = block.call
end
run(filename, source, context) click to toggle source
# File lib/optimize-js/sprockets-processor.rb, line 17
def run(filename, source, context)
  OptimizeJS.perform(source)
end

Public Instance Methods

render(context, _) click to toggle source
# File lib/optimize-js/sprockets-processor.rb, line 12
def render(context, _)
  self.class.run(@filename, @source, context)
end