Class: Plate::GetLocalNode

Inherits:
Struct
  • Object
show all
Defined in:
lib/plate/nodes.rb,
lib/plate/compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



15
16
17
# File 'lib/plate/nodes.rb', line 15

def name
  @name
end

Instance Method Details

#compile(compiler, parent = nil) ⇒ Object



67
68
69
70
71
72
73
74
75
76
# File 'lib/plate/compiler.rb', line 67

def compile(compiler, parent = nil)
  if parent && parent.is_a?(StyleNode)
    compiler.meta[name].nil? ? name : compiler.meta[name]
  elsif parent && parent.is_a?(ScriptNode)
    name
  else
    r = (parent && parent.repeat?) || compiler.repeating?
    !r && compiler.meta[name].nil? ? name : "{{#{name}}}"
  end
end