Class: Plate::ScriptNode
- Inherits:
-
Struct
- Object
- Struct
- Plate::ScriptNode
- Defined in:
- lib/plate/nodes.rb,
lib/plate/compiler.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#event ⇒ Object
Returns the value of attribute event.
Instance Method Summary collapse
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body
21 22 23 |
# File 'lib/plate/nodes.rb', line 21 def body @body end |
#event ⇒ Object
Returns the value of attribute event
21 22 23 |
# File 'lib/plate/nodes.rb', line 21 def event @event end |
Instance Method Details
#compile(compiler, parent = nil) ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/plate/compiler.rb', line 113 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 |