Sha256: e5ee62fcf70204faaf21ad638c59377d35a8e30b7d4936c347f070787b73817d

Contents?: true

Size: 726 Bytes

Versions: 19

Compression:

Stored size: 726 Bytes

Contents

# frozen_string_literal: true
require 'sprockets/autoload'

module Sprockets
  # Processor engine class for the EJS compiler. Depends on the `ejs` gem.
  #
  # For more infomation see:
  #
  #   https://github.com/sstephenson/ruby-ejs
  #
  module EjsProcessor
    VERSION = '1'

    def self.cache_key
      @cache_key ||= "#{name}:#{VERSION}".freeze
    end

    # Compile template data with EJS compiler.
    #
    # Returns a JS function definition String. The result should be
    # assigned to a JS variable.
    #
    #     # => "function(obj){...}"
    #
    def self.call(input)
      data = input[:data]
      input[:cache].fetch([cache_key, data]) do
        Autoload::EJS.compile(data)
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 6 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/ejs_processor.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/ejs_processor.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/sprockets-4.0.2/lib/sprockets/ejs_processor.rb
sprockets-4.0.2 lib/sprockets/ejs_processor.rb
sprockets-4.0.1 lib/sprockets/ejs_processor.rb
argon-1.3.1 vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.0/lib/sprockets/ejs_processor.rb
symbolic_enum-1.1.5 vendor/bundle/ruby/2.7.0/gems/sprockets-4.0.0/lib/sprockets/ejs_processor.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/sprockets-4.0.0/lib/sprockets/ejs_processor.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/sprockets-4.0.0/lib/sprockets/ejs_processor.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/sprockets-4.0.0/lib/sprockets/ejs_processor.rb
sprockets-4.0.0 lib/sprockets/ejs_processor.rb
sprockets-4.0.0.beta10 lib/sprockets/ejs_processor.rb
sprockets-4.0.0.beta9 lib/sprockets/ejs_processor.rb
sprockets-4.0.0.beta8 lib/sprockets/ejs_processor.rb
sprockets-4.0.0.beta7 lib/sprockets/ejs_processor.rb
sprockets-4.0.0.beta6 lib/sprockets/ejs_processor.rb
sprockets-4.0.0.beta5 lib/sprockets/ejs_processor.rb
sprockets-4.0.0.beta4 lib/sprockets/ejs_processor.rb
sprockets-4.0.0.beta3 lib/sprockets/ejs_processor.rb