Skip to content
Browse files

extract formats_regexp as a method

  • Loading branch information...
1 parent 15d3c77 commit 6c8ea8338584da0891ab29e0c35b5ed22e526ee2 @spastorino spastorino committed Oct 16, 2010
Showing with 5 additions and 2 deletions.
  1. +5 −2 actionpack/lib/action_view/renderer/abstract_renderer.rb
View
7 actionpack/lib/action_view/renderer/abstract_renderer.rb
@@ -16,15 +16,18 @@ def render
# 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={})

0 comments on commit 6c8ea83

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