Class: SyntaxTree::Haml::Plain
- Inherits:
-
Object
- Object
- SyntaxTree::Haml::Plain
- Defined in:
- lib/syntax_tree/haml/plain.rb
Overview
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #format(q) ⇒ Object
-
#initialize(node) ⇒ Plain
constructor
A new instance of Plain.
- #pretty_print(q) ⇒ Object
Constructor Details
#initialize(node) ⇒ Plain
Returns a new instance of Plain.
9 10 11 |
# File 'lib/syntax_tree/haml/plain.rb', line 9 def initialize(node) @node = node end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
7 8 9 |
# File 'lib/syntax_tree/haml/plain.rb', line 7 def node @node end |
Instance Method Details
#format(q) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/syntax_tree/haml/plain.rb', line 13 def format(q) text = node.value[:text] q.text("\\") if escaped?(text) q.text(text) end |
#pretty_print(q) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/syntax_tree/haml/plain.rb', line 20 def pretty_print(q) q.group(2, "(plain", ")") do q.breakable q.text("text=") q.pp(node.value[:text]) end end |