Sha256: 48b0b727daa0a896443c97bd74268e996886723c9c1949090ecaf3f08874ecac

Contents?: true

Size: 872 Bytes

Versions: 2

Compression:

Stored size: 872 Bytes

Contents

require "coffee-script"

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

  class Template
    self.default_mime_type = "application/javascript"

    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
#{self.class.skim_src unless engine.options[:use_asset]}
return (context = {}) ->
  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

2 entries across 2 versions & 1 rubygems

Version Path
skim-0.8.6 lib/skim/template.rb
skim-0.8.5 lib/skim/template.rb