class Xray::Engine::JavascriptPreprocessor
Sprockets preprocessor interface which supports all versions of Sprockets. See: github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
Public Class Methods
call(input)
click to toggle source
# File lib/xray/engine.rb, line 66 def self.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/xray/engine.rb, line 48 def initialize(filename, &block) @filename = filename @source = block.call end
run(filename, source, context)
click to toggle source
# File lib/xray/engine.rb, line 57 def self.run(filename, source, context) path = context.pathname.to_s if path =~ /^#{Rails.root}.+\.(jst)(\.|$)/ Xray.augment_template(source, path) else source end end
Public Instance Methods
render(context, empty_hash_wtf)
click to toggle source
# File lib/xray/engine.rb, line 53 def render(context, empty_hash_wtf) self.class.run(@filename, @source, context) end