diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-10-16 14:12:41 -0200 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-10-16 14:12:41 -0200 |
commit | 6c8ea8338584da0891ab29e0c35b5ed22e526ee2 (patch) | |
tree | 837df830fe1fde79ef63eae4e802378063ef5da1 /actionpack/lib | |
parent | 15d3c77bc272e5bd3c54d7ed40e9a4ecb1dfdf58 (diff) | |
download | rails-6c8ea8338584da0891ab29e0c35b5ed22e526ee2.tar.gz rails-6c8ea8338584da0891ab29e0c35b5ed22e526ee2.tar.bz2 rails-6c8ea8338584da0891ab29e0c35b5ed22e526ee2.zip |
extract formats_regexp as a method
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/renderer/abstract_renderer.rb | 7 |
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={}) |