class Bade::AST::Document

Attributes

file_path[R]

Path to this document, but only if it is defined from file

@return [String, nil]

root[R]

Root node of this document

@return [Bade::Node]

sub_documents[R]

@return [Array<Bade::Document>]

Public Class Methods

new(root: Node.new(:root), file_path: nil) click to toggle source

@param root [Bade::Node]

# File lib/bade/ast/document.rb, line 27
def initialize(root: Node.new(:root), file_path: nil)
  @root = root

  @file_path = file_path.dup.freeze unless file_path.nil?
  @sub_documents = []
end

Public Instance Methods

==(other) click to toggle source

@param other [Bade::Document]

@return [Bool]

# File lib/bade/ast/document.rb, line 46
def ==(other)
  return false unless other.is_a?(Document)

  root == other.root && sub_documents == other.sub_documents
end
freeze() click to toggle source
Calls superclass method
# File lib/bade/ast/document.rb, line 34
def freeze
  super

  root.freeze
  sub_documents.freeze
  sub_documents.each(&:freeze)
end