Sha256: 89001d101e57e8a47093080bcc91332110d5e8cc93ce3d38f0a3f1c6ab4af4c4

Contents?: true

Size: 794 Bytes

Versions: 3

Compression:

Stored size: 794 Bytes

Contents

module Skim
  Template = Temple::Templates::Tilt(Skim::Engine, :register_as => :skim)

  class Template
    def coffee_script_src
      engine = self.class.build_engine({
        :streaming => false, # Overwrite option: No streaming support in Tilt
        :file => eval_file,
        :indent => 2 }, options)
      <<SRC
return (context = {}) ->
  #{self.class.skim_src unless engine.options[:use_asset]}
  Skim.withContext.call {}, context, ->
#{engine.call(data)}
SRC
    end

    def prepare
      @src = CoffeeScript.compile(coffee_script_src)
    end

    def evaluate(scope, locals, &block)
      precompiled_template
    end

    def self.skim_src
      @@skim_src ||=
        File.read(File.expand_path("../../../vendor/assets/javascripts/skim.js.coffee", __FILE__))
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
skim-0.8.2 lib/skim/template.rb
skim-0.8.1 lib/skim/template.rb
skim-0.8.0 lib/skim/template.rb