lib/skim/template.rb in skim-0.10.0 vs lib/skim/template.rb in skim-0.11.0
- old
+ new
@@ -4,10 +4,18 @@
Template = Temple::Templates::Tilt(Skim::Engine, :register_as => :skim)
class Template
self.default_mime_type = "application/javascript"
+ def self.call(input)
+ source = input[:data]
+ context = input[:environment].context_class.new(input)
+
+ result = new { source }.render
+ context.metadata.merge(data: result)
+ end
+
def coffee_script_src
engine = Engine.new(options.merge({
:streaming => false, # Overwrite option: No streaming support in Tilt
:file => eval_file,
@@ -15,10 +23,10 @@
}))
src = engine.call(data)
<<-SRC
#{self.class.skim_src unless engine.options[:use_asset]}
return (context = {}) ->
- Skim.withContext.call {}, context, ->
+ (context.Skim || Skim).withContext.call {}, context, ->
#{src}
SRC
end
def prepare