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, #replace_child, #statements

Constructor Details

#initializeDocument

Returns a new instance of Document.



113
114
115
# File 'lib/xrt/statement.rb', line 113

def initialize
  @children = []
end

Instance Method Details

#<<(statement) ⇒ Object



117
118
119
# File 'lib/xrt/statement.rb', line 117

def << statement
  @children << statement
end

#==(other) ⇒ Object



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

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

#childrenObject



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

def children
  @children
end

#contentObject



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

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

#inspectObject



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

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