Class: Plate::HeaderNode
- Defined in:
- lib/plate/nodes.rb,
lib/plate/compiler.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from RichNode
#body, #parent, #scripts, #styles
Instance Method Summary collapse
- #compile(compiler, parent = nil) ⇒ Object
-
#initialize(level, text, body) ⇒ HeaderNode
constructor
A new instance of HeaderNode.
- #inspect ⇒ Object
Methods inherited from RichNode
#compile_body, #parent_repeat?, #repeat?
Methods included from Inspector
Constructor Details
#initialize(level, text, body) ⇒ HeaderNode
Returns a new instance of HeaderNode.
44 45 46 47 48 |
# File 'lib/plate/nodes.rb', line 44 def initialize(level, text, body) super(body) self.level = level self.text = text end |
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level.
43 44 45 |
# File 'lib/plate/nodes.rb', line 43 def level @level end |
#text ⇒ Object
Returns the value of attribute text.
43 44 45 |
# File 'lib/plate/nodes.rb', line 43 def text @text end |
Instance Method Details
#compile(compiler, parent = nil) ⇒ Object
215 216 217 218 219 |
# File 'lib/plate/compiler.rb', line 215 def compile(compiler, parent = nil) tag = "h#{level}" style, script = compile_body(compiler, parent) "<#{tag}#{style}#{script}>#{text.compile(compiler, self)}</#{tag}>" end |
#inspect ⇒ Object
50 51 52 |
# File 'lib/plate/nodes.rb', line 50 def inspect inspect_with([level, text]) end |