Class: XRT::Statement::Block
Instance Method Summary
collapse
#==, #auto_indent, #contains_directive?, #depth, #find_block_texts, #find_blocks, #find_blocks_with_directive, #include?, #replace_child, #statements
Constructor Details
#initialize(content) ⇒ Block
Returns a new instance of Block.
165
166
167
168
169
|
# File 'lib/xrt/statement.rb', line 165
def initialize(content)
@children = []
self << Directive.new(content)
end
|
Instance Method Details
#<<(statement) ⇒ Object
175
176
177
178
|
# File 'lib/xrt/statement.rb', line 175
def << statement
raise "trying to push_child to closed block: #{self.inspect} << #{statement.inspect}" if closed?
@children << statement
end
|
#children ⇒ Object
180
181
182
|
# File 'lib/xrt/statement.rb', line 180
def children
@children
end
|
#closed? ⇒ Boolean
171
172
173
|
# File 'lib/xrt/statement.rb', line 171
def closed?
children.last.kind_of? End
end
|
#content ⇒ Object
184
185
186
|
# File 'lib/xrt/statement.rb', line 184
def content
children.map{|c| c.content }.join
end
|
#inspect ⇒ Object
188
189
190
|
# File 'lib/xrt/statement.rb', line 188
def inspect
"(#{self.class}:#{self.children})"
end
|