Module: ActionView::Renderable

Defined in:
lib/rails_ext/action_controller/content_for_assignments.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#content_assignments_proc(view) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/rails_ext/action_controller/content_for_assignments.rb', line 15

def content_assignments_proc(view)
  Proc.new do |*names|
    ivar = :@_proc_for_layout
    if !view.instance_variable_defined?(:"@content_for_#{names.first}") && view.instance_variable_defined?(ivar) && (proc = view.instance_variable_get(ivar))
      view.capture(*names, &proc)
    elsif view.instance_variable_defined?(ivar = :"@content_for_#{names.first || :layout}")
      view.instance_variable_get(ivar)
    end
  end
end

#render(view, local_assigns = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/rails_ext/action_controller/content_for_assignments.rb', line 4

def render(view, local_assigns = {})
  compile(local_assigns)

  view.with_template self do
    view.send(:_evaluate_assigns_and_ivars)
    view.send(:_set_controller_content_type, mime_type) if respond_to?(:mime_type)

    view.send(method_name(local_assigns), local_assigns, &content_assignments_proc(view))
  end
end