Sha256: b8001379f2504fd4beeebf634509cf9f69385cd9994159049223ebb14e9c9f0e

Contents?: true

Size: 803 Bytes

Versions: 11

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true
require 'sprockets/autoload'

module Sprockets
  # Processor engine class for the Eco compiler. Depends on the `eco` gem.
  #
  # For more information see:
  #
  #   https://github.com/sstephenson/ruby-eco
  #   https://github.com/sstephenson/eco
  #
  module EcoProcessor
    VERSION = '1'

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

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

Version data entries

11 entries across 10 versions & 5 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/sprockets-4.2.1/lib/sprockets/eco_processor.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/eco_processor.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/sprockets-4.2.1/lib/sprockets/eco_processor.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/sprockets-4.2.1/lib/sprockets/eco_processor.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/sprockets-4.1.1/lib/sprockets/eco_processor.rb
sprockets-4.2.1 lib/sprockets/eco_processor.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/sprockets-4.1.1/lib/sprockets/eco_processor.rb
sprockets-4.2.0 lib/sprockets/eco_processor.rb
sprockets-4.1.1 lib/sprockets/eco_processor.rb
sprockets-4.1.0 lib/sprockets/eco_processor.rb
sprockets-4.0.3 lib/sprockets/eco_processor.rb