private Method

Base.create_template_source(handler, template, render_symbol, locals)

Method to create the source code for a given template.

Source Code

# File action_view/base.rb, line 560
def create_template_source(handler, template, render_symbol, locals)
  body = delegate_compile(handler, template)

  @@template_args[render_symbol] ||= {}
  locals_keys = @@template_args[render_symbol].keys | locals
  @@template_args[render_symbol] = locals_keys.inject({}) { |h, k| h[k] = true; h }

  locals_code = ""
  locals_keys.each do |key|
    locals_code << "#{key} = local_assigns[:#{key}]\n"
  end

  "def #{render_symbol}(local_assigns)\n#{locals_code}#{body}\nend"
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.