Class: Bade::AST::Document
Instance Attribute Summary collapse
-
#file_path ⇒ String?
readonly
Path to this document, but only if it is defined from file.
-
#root ⇒ Bade::Node
readonly
Root node of this document.
- #sub_documents ⇒ Array<Bade::Document> readonly
Instance Method Summary collapse
- #==(other) ⇒ Bool
- #freeze ⇒ Object
-
#initialize(root: Node.new(:root, nil), file_path: nil) ⇒ Document
constructor
A new instance of Document.
Constructor Details
#initialize(root: Node.new(:root, nil), file_path: nil) ⇒ Document
Returns a new instance of Document.
27 28 29 30 31 32 |
# File 'lib/bade/ast/document.rb', line 27 def initialize(root: Node.new(:root, nil), file_path: nil) @root = root @file_path = file_path.dup.freeze unless file_path.nil? @sub_documents = [] end |
Instance Attribute Details
#file_path ⇒ String? (readonly)
Path to this document, but only if it is defined from file
19 20 21 |
# File 'lib/bade/ast/document.rb', line 19 def file_path @file_path end |
#root ⇒ Bade::Node (readonly)
Root node of this document
13 14 15 |
# File 'lib/bade/ast/document.rb', line 13 def root @root end |
#sub_documents ⇒ Array<Bade::Document> (readonly)
23 24 25 |
# File 'lib/bade/ast/document.rb', line 23 def sub_documents @sub_documents end |