Skip to content
This repository
Browse code

Prefix ActionView::Base private methods with an underscore

  • Loading branch information...
commit 8eec694598978ec054d8fc8daf2ee704baf794fe 1 parent 56c2b02
Joshua Peek authored
2  actionpack/lib/action_controller/base.rb
@@ -917,7 +917,7 @@ def render(options = nil, extra_options = {}, &block) #:doc:
917 917
             end
918 918
 
919 919
           elsif options[:update]
920  
-            @template.send! :evaluate_assigns_and_ivars
  920
+            @template.send(:_evaluate_assigns_and_ivars)
921 921
 
922 922
             generator = ActionView::Helpers::PrototypeHelper::JavaScriptGenerator.new(@template, &block)
923 923
             response.content_type = Mime::JS
2  actionpack/lib/action_controller/test_process.rb
@@ -218,7 +218,7 @@ def redirect_url_match?( pattern )
218 218
     # Returns the template of the file which was used to
219 219
     # render this response (or nil)
220 220
     def rendered_template
221  
-      template._first_render
  221
+      template.send(:_first_render)
222 222
     end
223 223
 
224 224
     # A shortcut to the flash. Returns an empty hash if no session flash exists.
11  actionpack/lib/action_view/base.rb
@@ -162,7 +162,6 @@ class Base
162 162
 
163 163
     attr_accessor :base_path, :assigns, :template_extension
164 164
     attr_accessor :controller
165  
-    attr_accessor :_first_render, :_last_render
166 165
 
167 166
     attr_writer :template_format
168 167
 
@@ -247,7 +246,7 @@ def render(options = {}, local_assigns = {}, &block) #:nodoc:
247 246
       elsif options.is_a?(Hash)
248 247
         options = options.reverse_merge(:locals => {})
249 248
         if options[:layout]
250  
-          render_with_layout(options, local_assigns, &block)
  249
+          _render_with_layout(options, local_assigns, &block)
251 250
         elsif options[:file]
252 251
           if options[:use_full_path]
253 252
             ActiveSupport::Deprecation.warn("use_full_path option has been deprecated and has no affect.", caller)
@@ -329,8 +328,10 @@ def pick_template(template_path)
329 328
     memoize :pick_template
330 329
 
331 330
     private
  331
+      attr_accessor :_first_render, :_last_render
  332
+
332 333
       # Evaluate the local assigns and pushes them to the view.
333  
-      def evaluate_assigns_and_ivars
  334
+      def _evaluate_assigns_and_ivars #:nodoc:
334 335
         unless @assigns_added
335 336
           @assigns.each { |key, value| instance_variable_set("@#{key}", value) }
336 337
 
@@ -344,13 +345,13 @@ def evaluate_assigns_and_ivars
344 345
         end
345 346
       end
346 347
 
347  
-      def set_controller_content_type(content_type)
  348
+      def _set_controller_content_type(content_type) #:nodoc:
348 349
         if controller.respond_to?(:response)
349 350
           controller.response.content_type ||= content_type
350 351
         end
351 352
       end
352 353
 
353  
-      def render_with_layout(options, local_assigns, &block)
  354
+      def _render_with_layout(options, local_assigns, &block) #:nodoc:
354 355
         partial_layout = options.delete(:layout)
355 356
 
356 357
         if block_given?
8  actionpack/lib/action_view/renderable.rb
@@ -26,11 +26,11 @@ def compiled_source
26 26
     def render(view, local_assigns = {})
27 27
       compile(local_assigns)
28 28
 
29  
-      view._first_render ||= self
30  
-      view._last_render = self
  29
+      view.send(:_first_render=, self) unless view.send(:_first_render)
  30
+      view.send(:_last_render=, self)
31 31
 
32  
-      view.send(:evaluate_assigns_and_ivars)
33  
-      view.send(:set_controller_content_type, mime_type) if respond_to?(:mime_type)
  32
+      view.send(:_evaluate_assigns_and_ivars)
  33
+      view.send(:_set_controller_content_type, mime_type) if respond_to?(:mime_type)
34 34
 
35 35
       view.send(method_name(local_assigns), local_assigns) do |*names|
36 36
         if proc = view.instance_variable_get("@_proc_for_layout")
2  actionpack/lib/action_view/template_handlers/builder.rb
@@ -6,7 +6,7 @@ class Builder < TemplateHandler
6 6
       include Compilable
7 7
 
8 8
       def compile(template)
9  
-        "set_controller_content_type(Mime::XML);" +
  9
+        "_set_controller_content_type(Mime::XML);" +
10 10
           "xml = ::Builder::XmlMarkup.new(:indent => 2);" +
11 11
           "self.output_buffer = xml.target!;" +
12 12
           template.source +

0 notes on commit 8eec694

Please sign in to comment.
Something went wrong with that request. Please try again.