Class: SyntaxTree::ERB::Element
- Defined in:
- lib/syntax_tree/erb/nodes.rb
Overview
This is a base class for a Node that can also hold an appended new line.
Direct Known Subclasses
CharData, Doctype, ErbClose, ErbComment, ErbNode, ErbYield, HtmlComment, HtmlNode::ClosingTag, HtmlNode::OpeningTag
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#new_line ⇒ Object
readonly
Returns the value of attribute new_line.
Instance Method Summary collapse
- #deconstruct_keys(keys) ⇒ Object
-
#initialize(new_line:, location:) ⇒ Element
constructor
A new instance of Element.
- #without_new_line ⇒ Object
Methods inherited from Node
#format, #pretty_print, #skip?
Constructor Details
#initialize(new_line:, location:) ⇒ Element
Returns a new instance of Element.
84 85 86 87 |
# File 'lib/syntax_tree/erb/nodes.rb', line 84 def initialize(new_line:, location:) @new_line = new_line @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
82 83 84 |
# File 'lib/syntax_tree/erb/nodes.rb', line 82 def location @location end |
#new_line ⇒ Object (readonly)
Returns the value of attribute new_line.
82 83 84 |
# File 'lib/syntax_tree/erb/nodes.rb', line 82 def new_line @new_line end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Object
93 94 95 |
# File 'lib/syntax_tree/erb/nodes.rb', line 93 def deconstruct_keys(keys) { new_line: new_line, location: location } end |
#without_new_line ⇒ Object
89 90 91 |
# File 'lib/syntax_tree/erb/nodes.rb', line 89 def without_new_line self.class.new(**deconstruct_keys([]).merge(new_line: nil)) end |