HEX
Server: Apache
System: Linux iad1-shared-e1-13 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User: dh_x7ke6i (5503775)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //lib/ruby/vendor_ruby/sprockets/legacy_tilt_processor.rb
require 'delegate'

module Sprockets
  # Deprecated: Wraps legacy engine and process Tilt templates with new
  # processor call signature.
  #
  # Will be removed in Sprockets 4.x.
  #
  #     LegacyTiltProcessor.new(Tilt::CoffeeScriptProcessor)
  #
  class LegacyTiltProcessor < Delegator
    def initialize(klass)
      @klass = klass
    end

    def __getobj__
      @klass
    end

    def call(input)
      filename = input[:filename]
      data     = input[:data]
      context  = input[:environment].context_class.new(input)

      data = @klass.new(filename) { data }.render(context, {})
      context.metadata.merge(data: data.to_str)
    end
  end
end