Class: XRT::Statement::Block
Instance Method Summary
collapse
#==, #auto_indent, #depth, #find_block_texts, #find_blocks, #replace_child, #statements
Constructor Details
#initialize(content) ⇒ Block
133
134
135
136
|
# File 'lib/xrt/statement.rb', line 133
def initialize(content)
super
@children = []
end
|
Instance Method Details
#<<(statement) ⇒ Object
142
143
144
145
|
# File 'lib/xrt/statement.rb', line 142
def << statement
raise 'trying to push_child to closed block' if closed?
@children << statement
end
|
#children ⇒ Object
147
148
149
|
# File 'lib/xrt/statement.rb', line 147
def children
@children
end
|
#closed? ⇒ Boolean
138
139
140
|
# File 'lib/xrt/statement.rb', line 138
def closed?
children.last.kind_of? End
end
|
#content ⇒ Object
151
152
153
|
# File 'lib/xrt/statement.rb', line 151
def content
@content + children.map{|c| c.content }.join
end
|
#inspect ⇒ Object
155
156
157
|
# File 'lib/xrt/statement.rb', line 155
def inspect
"<#{self.class}:#{@content},#{self.children}>"
end
|