aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template/partial.rb
diff options
context:
space:
mode:
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