123456789_123456789_123456789_123456789_123456789_

Module: Sprockets::EjsProcessor

Relationships & Source Files
Defined in: lib/sprockets/ejs_processor.rb

Overview

Processor engine class for the EJS compiler. Depends on the ejs gem.

For more information see:

github.com/sstephenson/ruby-ejs

Constant Summary

Class Method Summary

Class Method Details

.cache_key

[ GitHub ]

  
# File 'lib/sprockets/ejs_processor.rb', line 14

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

.call(input)

Compile template data with EJS compiler.

Returns a JS function definition String. The result should be assigned to a JS variable.

# => "function(obj){...}"
[ GitHub ]

  
# File 'lib/sprockets/ejs_processor.rb', line 25

def self.call(input)
  data = input[:data]
  input[:cache].fetch([cache_key, data]) do
    Autoload::EJS.compile(data)
  end
end