Class: SyntaxTree::ERB::Document
- Defined in:
- lib/syntax_tree/erb/nodes.rb
Overview
The Document node is the top of the syntax tree. It contains any number of:
- 
Text 
- 
HtmlNode 
- 
ErbNodes 
Instance Attribute Summary collapse
- 
  
    
      #elements  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute elements. 
- 
  
    
      #location  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute location. 
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #deconstruct_keys(keys) ⇒ Object
- 
  
    
      #initialize(elements:, location:)  ⇒ Document 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Document. 
Methods inherited from Node
#format, #pretty_print, #skip?, #without_new_line
Constructor Details
#initialize(elements:, location:) ⇒ Document
Returns a new instance of Document.
| 101 102 103 104 | # File 'lib/syntax_tree/erb/nodes.rb', line 101 def initialize(elements:, location:) @elements = elements @location = location end | 
Instance Attribute Details
#elements ⇒ Object (readonly)
Returns the value of attribute elements.
| 99 100 101 | # File 'lib/syntax_tree/erb/nodes.rb', line 99 def elements @elements end | 
#location ⇒ Object (readonly)
Returns the value of attribute location.
| 99 100 101 | # File 'lib/syntax_tree/erb/nodes.rb', line 99 def location @location end | 
Instance Method Details
#accept(visitor) ⇒ Object
| 106 107 108 | # File 'lib/syntax_tree/erb/nodes.rb', line 106 def accept(visitor) visitor.visit_document(self) end | 
#child_nodes ⇒ Object Also known as: deconstruct
| 110 111 112 | # File 'lib/syntax_tree/erb/nodes.rb', line 110 def child_nodes [*elements].compact end | 
#deconstruct_keys(keys) ⇒ Object
| 116 117 118 | # File 'lib/syntax_tree/erb/nodes.rb', line 116 def deconstruct_keys(keys) { elements: elements, location: location } end |