123456789_123456789_123456789_123456789_123456789_

Module: Sprockets::EcoProcessor

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

Overview

Processor engine class for the Eco compiler. Depends on the eco gem.

For more information see:

github.com/sstephenson/ruby-eco github.com/sstephenson/eco

Constant Summary

Class Method Summary

Class Method Details

.cache_key

[ GitHub ]

  
# File 'lib/sprockets/eco_processor.rb', line 15

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

.call(input)

Compile template data with Eco compiler.

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

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

  
# File 'lib/sprockets/eco_processor.rb', line 26

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