Class: XRT::Statement::Block
Instance Method Summary
collapse
#==, #auto_indent, #depth, #find_blocks, #replace_child
Constructor Details
#initialize(content) ⇒ Block
Returns a new instance of Block.
118
119
120
121
|
# File 'lib/xrt/statement.rb', line 118
def initialize(content)
super
@children = []
end
|
Instance Method Details
#<<(statement) ⇒ Object
127
128
129
130
|
# File 'lib/xrt/statement.rb', line 127
def << statement
raise 'trying to push_child to closed block' if closed?
@children << statement
end
|
#children ⇒ Object
132
133
134
|
# File 'lib/xrt/statement.rb', line 132
def children
@children
end
|
#closed? ⇒ Boolean
123
124
125
|
# File 'lib/xrt/statement.rb', line 123
def closed?
children.last.kind_of? End
end
|
#content ⇒ Object
136
137
138
|
# File 'lib/xrt/statement.rb', line 136
def content
@content + children.map{|c| c.content }.join
end
|
#inspect ⇒ Object
140
141
142
|
# File 'lib/xrt/statement.rb', line 140
def inspect
"<#{self.class}:#{@content},#{self.children}>"
end
|