Permalink
Browse files

Prefix ActionView::Base private methods with an underscore

  • Loading branch information...
1 parent 56c2b02 commit 8eec694598978ec054d8fc8daf2ee704baf794fe @josh josh committed Aug 31, 2008
@@ -917,7 +917,7 @@ def render(options = nil, extra_options = {}, &block) #:doc:
end
elsif options[:update]
- @template.send! :evaluate_assigns_and_ivars
+ @template.send(:_evaluate_assigns_and_ivars)
generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(@template, &block)
response.content_type = Mime::JS
@@ -218,7 +218,7 @@ def redirect_url_match?( pattern )
# Returns the template of the file which was used to
# render this response (or nil)
def rendered_template
- template._first_render
+ template.send(:_first_render)
end
# A shortcut to the flash. Returns an empty hash if no session flash exists.
@@ -162,7 +162,6 @@ class Base
attr_accessor :base_path, :assigns, :template_extension
attr_accessor :controller
- attr_accessor :_first_render, :_last_render
attr_writer :template_format
@@ -247,7 +246,7 @@ def render(options = {}, local_assigns = {}, &block) #:nodoc:
elsif options.is_a?(Hash)
options = options.reverse_merge(:locals => {})
if options[:layout]
- render_with_layout(options, local_assigns, &block)
+ _render_with_layout(options, local_assigns, &block)
elsif options[:file]
if options[:use_full_path]
ActiveSupport::Deprecation.warn("use_full_path option has been deprecated and has no affect.", caller)
@@ -329,8 +328,10 @@ def pick_template(template_path)
memoize :pick_template
private
+ attr_accessor :_first_render, :_last_render
+
# Evaluate the local assigns and pushes them to the view.
- def evaluate_assigns_and_ivars
+ def _evaluate_assigns_and_ivars #:nodoc:
unless @assigns_added
@assigns.each { |key, value| instance_variable_set("@#{key}", value) }
@@ -344,13 +345,13 @@ def evaluate_assigns_and_ivars
end
end
- def set_controller_content_type(content_type)
+ def _set_controller_content_type(content_type) #:nodoc:
if controller.respond_to?(:response)
controller.response.content_type ||= content_type
end
end
- def render_with_layout(options, local_assigns, &block)
+ def _render_with_layout(options, local_assigns, &block) #:nodoc:
partial_layout = options.delete(:layout)
if block_given?
@@ -26,11 +26,11 @@ def compiled_source
def render(view, local_assigns = {})
compile(local_assigns)
- view._first_render ||= self
- view._last_render = self
+ view.send(:_first_render=, self) unless view.send(:_first_render)
+ view.send(:_last_render=, self)
- view.send(:evaluate_assigns_and_ivars)
- view.send(:set_controller_content_type, mime_type) if respond_to?(:mime_type)
+ 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) do |*names|
if proc = view.instance_variable_get("@_proc_for_layout")
@@ -6,7 +6,7 @@ class Builder < TemplateHandler
include Compilable
def compile(template)
- "set_controller_content_type(Mime::XML);" +
+ "_set_controller_content_type(Mime::XML);" +
"xml = ::Builder::XmlMarkup.new(:indent => 2);" +
"self.output_buffer = xml.target!;" +
template.source +

0 comments on commit 8eec694

Please sign in to comment.