Sha256: 0d497797b48cacd62a2968dcecd2bc2c7fce3473a814d93ba65153c0dacd6663

Contents?: true

Size: 709 Bytes

Versions: 14

Compression:

Stored size: 709 Bytes

Contents

require 'delegate'

module Sprockets
  # Deprecated: Wraps legacy process Procs with new processor call signature.
  #
  # Will be removed in Sprockets 4.x.
  #
  #     LegacyProcProcessor.new(:compress,
  #       proc { |context, data| data.gsub(...) })
  #
  class LegacyProcProcessor < Delegator
    def initialize(name, proc)
      @name = name
      @proc = proc
    end

    def __getobj__
      @proc
    end

    def name
      "Sprockets::LegacyProcProcessor (#{@name})"
    end

    def to_s
      name
    end

    def call(input)
      context = input[:environment].context_class.new(input)
      data = @proc.call(context, input[:data])
      context.metadata.merge(data: data)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
sprockets-3.0.1 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.rc.2 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.rc.1 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.10 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.9 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.8 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.7 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.6 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.5 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.4 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.3 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.2 lib/sprockets/legacy_proc_processor.rb
sprockets-3.0.0.beta.1 lib/sprockets/legacy_proc_processor.rb