Class: Plate::LinkNode
- Inherits:
-
AttributableNode
- Object
- Struct
- AttributableNode
- Plate::LinkNode
- Defined in:
- lib/plate/nodes.rb,
lib/plate/compiler.rb
Instance Attribute Summary collapse
-
#href ⇒ Object
Returns the value of attribute href.
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from AttributableNode
Instance Method Summary collapse
- #compile(compiler, parent = nil) ⇒ Object
-
#initialize(text, href, attributes) ⇒ LinkNode
constructor
A new instance of LinkNode.
- #inspect ⇒ Object
Methods inherited from AttributableNode
Methods included from Inspector
Constructor Details
#initialize(text, href, attributes) ⇒ LinkNode
Returns a new instance of LinkNode.
85 86 87 88 89 |
# File 'lib/plate/nodes.rb', line 85 def initialize(text, href, attributes) self.text = text self.href = href self.attributes = attributes end |
Instance Attribute Details
#href ⇒ Object
Returns the value of attribute href.
84 85 86 |
# File 'lib/plate/nodes.rb', line 84 def href @href end |
#text ⇒ Object
Returns the value of attribute text.
84 85 86 |
# File 'lib/plate/nodes.rb', line 84 def text @text end |
Instance Method Details
#compile(compiler, parent = nil) ⇒ Object
231 232 233 234 235 |
# File 'lib/plate/compiler.rb', line 231 def compile(compiler, parent = nil) content = text.compile(compiler) attr = compile_attributes(compiler) "<a href=\"#{href.compile(compiler)}\"#{attr}>#{content}</a>" end |
#inspect ⇒ Object
91 92 93 |
# File 'lib/plate/nodes.rb', line 91 def inspect inspect_with([text, href]) end |