From 8eec694598978ec054d8fc8daf2ee704baf794fe Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 31 Aug 2008 10:45:59 -0500 Subject: Prefix ActionView::Base private methods with an underscore --- actionpack/lib/action_controller/base.rb | 2 +- actionpack/lib/action_controller/test_process.rb | 2 +- actionpack/lib/action_view/base.rb | 11 ++++++----- actionpack/lib/action_view/renderable.rb | 8 ++++---- actionpack/lib/action_view/template_handlers/builder.rb | 2 +- 5 files changed, 13 insertions(+), 12 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index f527b131d8..172bf7363f 100644 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -917,7 +917,7 @@ module ActionController #:nodoc: 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 diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index 1d0254b522..4065e9db6a 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -218,7 +218,7 @@ module ActionController #:nodoc: # 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. diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index e9087560a1..4453358d30 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -162,7 +162,6 @@ module ActionView #:nodoc: attr_accessor :base_path, :assigns, :template_extension attr_accessor :controller - attr_accessor :_first_render, :_last_render attr_writer :template_format @@ -247,7 +246,7 @@ module ActionView #: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 @@ module ActionView #:nodoc: 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 @@ module ActionView #:nodoc: 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? diff --git a/actionpack/lib/action_view/renderable.rb b/actionpack/lib/action_view/renderable.rb index 5d950e336e..d960335220 100644 --- a/actionpack/lib/action_view/renderable.rb +++ b/actionpack/lib/action_view/renderable.rb @@ -26,11 +26,11 @@ module ActionView 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") diff --git a/actionpack/lib/action_view/template_handlers/builder.rb b/actionpack/lib/action_view/template_handlers/builder.rb index 7d24a5c423..788dc93326 100644 --- a/actionpack/lib/action_view/template_handlers/builder.rb +++ b/actionpack/lib/action_view/template_handlers/builder.rb @@ -6,7 +6,7 @@ module ActionView 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 + -- cgit v1.2.3