Class: XRT::Statement::Document

Inherits:
XRT::Statement show all
Defined in:
lib/xrt/statement.rb

Instance Method Summary collapse

Methods inherited from XRT::Statement

#auto_indent, #contains_directive?, #depth, #find_block_texts, #find_blocks, #find_blocks_with_directive, #include?, #replace_child, #statements

Constructor Details

#initializeDocument

Returns a new instance of Document.



121
122
123
# File 'lib/xrt/statement.rb', line 121

def initialize
  @children = []
end

Instance Method Details

#<<(statement) ⇒ Object



125
126
127
# File 'lib/xrt/statement.rb', line 125

def << statement
  @children << statement
end

#==(other) ⇒ Object



137
138
139
# File 'lib/xrt/statement.rb', line 137

def == other
  self.content == other.content && self.children.zip(other.children).all{|a, b| p [a, b]; a == b }
end

#childrenObject



129
130
131
# File 'lib/xrt/statement.rb', line 129

def children
  @children
end

#contentObject



133
134
135
# File 'lib/xrt/statement.rb', line 133

def content
  children.map{|c| c.content }.join
end

#inspectObject



141
142
143
# File 'lib/xrt/statement.rb', line 141

def inspect
  "(#{self.class}:#{self.children})"
end