aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_view/renderer/abstract_renderer.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/renderer/abstract_renderer.rb b/actionpack/lib/action_view/renderer/abstract_renderer.rb
index e63f39db48..4a52b3172e 100644
--- a/actionpack/lib/action_view/renderer/abstract_renderer.rb
+++ b/actionpack/lib/action_view/renderer/abstract_renderer.rb
@@ -16,15 +16,18 @@ module ActionView
# the lookup context to take this new format into account.
def wrap_formats(value)
return yield unless value.is_a?(String)
- @@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/
- if value.sub!(@@formats_regexp, "")
+ if value.sub!(formats_regexp, "")
update_details(:formats => [$1.to_sym]){ yield }
else
yield
end
end
+ def formats_regexp
+ @@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/
+ end
+
protected
def instrument(name, options={})