22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/fortitude/tilt/fortitude_template.rb', line 22
def render(scope=Object.new, locals = nil, &block)
locals ||= { }
rendering_context = Fortitude::RenderingContext.new({
:yield_block => block, :render_yield_result => false,
:helpers_object => scope, :instance_variables_object => scope })
widget_assigns = { }.with_indifferent_access
scope.instance_variables.each do |instance_variable_name|
if instance_variable_name.to_s =~ /^\@(.*)$/
widget_assigns[$1] = scope.instance_variable_get(instance_variable_name)
end
end
widget_assigns = widget_assigns.merge(locals)
widget_assigns = fortitude_class.(widget_assigns) unless fortitude_class. == :use
widget = fortitude_class.new(widget_assigns)
widget.render_to(rendering_context)
rendering_context.output_buffer_holder.output_buffer
end
|