class Plate::ScriptNode

Public Instance Methods

compile(compiler, parent = nil) click to toggle source
# File lib/plate/compiler.rb, line 120
def compile(compiler, parent = nil)
  b = body.compile(compiler, self)
  key, val = case event
        when /repeat/
          ['repeat', b]
        else
          ['on', "#{event}: #{b}"]
        end
  parent.scripts[key] = [] if parent.scripts[key].nil?
  parent.scripts[key] << val
  ''
end