lib/temple/coffee_script/generators.rb in skim-0.9.1 vs lib/temple/coffee_script/generators.rb in skim-0.9.2
- old
+ new
@@ -5,14 +5,11 @@
class Generator < Temple::Generator
define_options :indent => 0
def call(exp)
@indent = options[:indent]
- compile [:multi,
- [:code, "#{buffer} = []"],
- exp,
- [:code, "#{buffer}.join('')"]]
+ compile [:multi, [:code, "#{buffer} = ''"], exp, [:code, "#{buffer}"]]
end
def on_multi(*exp)
exp.map {|e| compile(e) }.join("\n")
end
@@ -39,10 +36,10 @@
def on_capture(name, exp)
self.class.new(:buffer => name, :indent => @indent).call(exp)
end
def concat(str)
- indent("#{buffer}.push(#{str})")
+ indent "#{buffer} += #{str}"
end
def indent(str, indent = @indent)
" " * indent + str
end