Sha256: 25bc4f1450e5150acbdb65803eef8a61e37cb5f07ccb2ca6bbcfe1240d788acf

Contents?: true

Size: 617 Bytes

Versions: 13

Compression:

Stored size: 617 Bytes

Contents

require 'tilt'

module Sprockets
  # `Processor` creates an anonymous processor class from a block.
  #
  #     register_preprocessor 'text/css', :my_processor do |context, data|
  #       # ...
  #     end
  #
  class Processor < Tilt::Template
    # `processor` is a lambda or block
    def self.processor
      @processor
    end

    def self.name
      "Sprockets::Processor (#{@name})"
    end

    def self.to_s
      name
    end

    def prepare
    end

    # Call processor block with `context` and `data`.
    def evaluate(context, locals)
      self.class.processor.call(context, data)
    end
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
sprockets-2.12.5 lib/sprockets/processor.rb
arcabouco-0.2.13 vendor/bundle/gems/sprockets-2.12.4/lib/sprockets/processor.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/sprockets-2.12.4/lib/sprockets/processor.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/sprockets-2.12.3/lib/sprockets/processor.rb
sprockets-2.12.4 lib/sprockets/processor.rb
sprockets-2.12.3 lib/sprockets/processor.rb
sprockets-2.11.3 lib/sprockets/processor.rb
sprockets-2.10.2 lib/sprockets/processor.rb
sprockets-2.12.2 lib/sprockets/processor.rb
sprockets-2.12.1 lib/sprockets/processor.rb
sprockets-2.12.0 lib/sprockets/processor.rb
sprockets-2.11.0 lib/sprockets/processor.rb
sprockets-2.10.1 lib/sprockets/processor.rb