aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template/partial.rb
diff options
context:
space:
mode:
authorYehuda Katz <wycats@gmail.com>2009-01-22 16:18:10 -0600
committerJoshua Peek <josh@joshpeek.com>2009-01-22 16:18:10 -0600
commiteb9af20b7cc0e374277cf330bdd404f9daab28ec (patch)
treeba05a906690684e442ed92db3e63e295f0dd133e /actionpack/lib/action_view/template/partial.rb
parentcc0b5fa9930dcc60914e21b518b3c54109243cfa (diff)
downloadrails-eb9af20b7cc0e374277cf330bdd404f9daab28ec.tar.gz
rails-eb9af20b7cc0e374277cf330bdd404f9daab28ec.tar.bz2
rails-eb9af20b7cc0e374277cf330bdd404f9daab28ec.zip
Begin unifying the interface between ActionController and ActionView
Diffstat (limited to 'actionpack/lib/action_view/template/partial.rb')
-rw-r--r--actionpack/lib/action_view/template/partial.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/template/partial.rb b/actionpack/lib/action_view/template/partial.rb
new file mode 100644
index 0000000000..30dec1dc5b
--- /dev/null
+++ b/actionpack/lib/action_view/template/partial.rb
@@ -0,0 +1,18 @@
+module ActionView
+ # NOTE: The template that this mixin is being included into is frozen
+ # so you cannot set or modify any instance variables
+ module RenderablePartial #:nodoc:
+ extend ActiveSupport::Memoizable
+
+ def variable_name
+ name.sub(/\A_/, '').to_sym
+ end
+ memoize :variable_name
+
+ def counter_name
+ "#{variable_name}_counter".to_sym
+ end
+ memoize :counter_name
+
+ end
+end