class SprocketsIIFE::BundleProcessor
Public Class Methods
call(input)
click to toggle source
# File lib/sprockets-iife/bundle_processor.rb, line 16 def call(input) script_path = input[:filename] script_source = input[:data] context = input[:environment].context_class.new(input) context.metadata.merge(data: wrap(script_path, script_source)) end
new(script_path, &block)
click to toggle source
# File lib/sprockets-iife/bundle_processor.rb, line 6 def initialize(script_path, &block) @script_path = script_path @script_source = block.call end
wrap(script_path, script_source)
click to toggle source
# File lib/sprockets-iife/bundle_processor.rb, line 23 def wrap(script_path, script_source) script_iife_path = SprocketsIIFE::Utils.build_iife_path(script_path) if File.readable?(script_iife_path) && SprocketsIIFE::Utils.bundle?(script_path) SprocketsIIFE::Template.new(script_iife_path, script_source).result else script_source end end
Public Instance Methods
render(_, _)
click to toggle source
# File lib/sprockets-iife/bundle_processor.rb, line 11 def render(_, _) self.class.wrap(@script_path, @script_source) end