Class: ActionView::AbstractRenderer
- Inherits:
-
Object
- Object
- ActionView::AbstractRenderer
- Defined in:
- actionpack/lib/action_view/renderer/abstract_renderer.rb
Overview
:nodoc:
Instance Method Summary (collapse)
- - (Object) formats_regexp
-
- (AbstractRenderer) initialize(view)
constructor
A new instance of AbstractRenderer.
- - (Object) render
-
- (Object) wrap_formats(value)
Checks if the given path contains a format and if so, change the lookup context to take this new format into account.
Constructor Details
- (AbstractRenderer) initialize(view)
A new instance of AbstractRenderer
6 7 8 9 |
# File 'actionpack/lib/action_view/renderer/abstract_renderer.rb', line 6 def initialize(view) @view = view @lookup_context = view.lookup_context end |
Instance Method Details
- (Object) formats_regexp
27 28 29 |
# File 'actionpack/lib/action_view/renderer/abstract_renderer.rb', line 27 def formats_regexp @@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/ end |
- (Object) render
11 12 13 |
# File 'actionpack/lib/action_view/renderer/abstract_renderer.rb', line 11 def render raise NotImplementedError end |
- (Object) wrap_formats(value)
Checks if the given path contains a format and if so, change the lookup context to take this new format into account.
17 18 19 20 21 22 23 24 25 |
# File 'actionpack/lib/action_view/renderer/abstract_renderer.rb', line 17 def wrap_formats(value) return yield unless value.is_a?(String) if value.sub!(formats_regexp, "") update_details(:formats => [$1.to_sym]){ yield } else yield end end |