Class: XRT::Statement::Block
Direct Known Subclasses
Tag
Instance Method Summary
collapse
#==, #auto_indent, #contains_directive?, #depth, #find_block_texts, #find_blocks, #find_blocks_with_directive, #replace_child, #statements
Constructor Details
#initialize(content) ⇒ Block
Returns a new instance of Block.
157
158
159
160
161
|
# File 'lib/xrt/statement.rb', line 157
def initialize(content)
@children = []
self << Directive.new(content)
end
|
Instance Method Details
#<<(statement) ⇒ Object
167
168
169
170
|
# File 'lib/xrt/statement.rb', line 167
def << statement
raise 'trying to push_child to closed block' if closed?
@children << statement
end
|
#children ⇒ Object
172
173
174
|
# File 'lib/xrt/statement.rb', line 172
def children
@children
end
|
#closed? ⇒ Boolean
163
164
165
|
# File 'lib/xrt/statement.rb', line 163
def closed?
children.last.kind_of? End
end
|
#content ⇒ Object
176
177
178
|
# File 'lib/xrt/statement.rb', line 176
def content
children.map{|c| c.content }.join
end
|
#inspect ⇒ Object
180
181
182
|
# File 'lib/xrt/statement.rb', line 180
def inspect
"(#{self.class}:#{self.children})"
end
|