Class: Stencil::Block
Instance Method Summary
collapse
Methods inherited from Directive
#checked_render, create, #inspect_args, #interpret, #postrender, #pre_end, #prerender, register, #render_end, #setup_parameters
Constructor Details
#initialize(location, string) ⇒ Block
Returns a new instance of Block.
161
162
163
164
|
# File 'lib/stencil/directives/base.rb', line 161
def initialize(location, string)
super
@apply = []
end
|
Instance Method Details
#add(directive) ⇒ Object
170
171
172
|
# File 'lib/stencil/directives/base.rb', line 170
def add(directive)
@apply << directive
end
|
#ended(stack) ⇒ Object
185
186
187
|
# File 'lib/stencil/directives/base.rb', line 185
def ended(stack)
stack.pop
end
|
#inspect ⇒ Object
166
167
168
|
# File 'lib/stencil/directives/base.rb', line 166
def inspect
"[#{self.class.name.split("::").last} #{inspect_args} {#{@apply.map{|dr| dr.inspect}.join(" ")}}]"
end
|
#parsed(stack) ⇒ Object
174
175
176
177
|
# File 'lib/stencil/directives/base.rb', line 174
def parsed(stack)
super
stack << self
end
|
#render(state) ⇒ Object
179
180
181
182
183
|
# File 'lib/stencil/directives/base.rb', line 179
def render(state)
@apply.map do |directive|
directive.checked_render(state)
end.flatten.compact
end
|