class Plate::RichNode

Attributes

parent[RW]

Public Instance Methods

compile_body(compiler, parent) click to toggle source
# File lib/plate/compiler.rb, line 153
def compile_body(compiler, parent)
  self.parent = parent
  compiler.repeating = repeat?

  content = body.compile(compiler, self)

  style = styles.empty? ? '' : " style=\"#{styles.join(';')}\""

  script = if scripts.empty?
    ''
  else
    scripts.map do |k, v|
      " v-#{k}=\"#{v.join(',')}\""
    end.join('')
  end

  compiler.repeating = parent_repeat?
  [content, style, script]
end
parent_repeat?() click to toggle source
# File lib/plate/compiler.rb, line 145
def parent_repeat?
  parent && parent.repeat?
end
repeat?() click to toggle source
# File lib/plate/compiler.rb, line 149
def repeat?
  parent_repeat? || !scripts['repeat'].nil?
end