Class: ActionView::AbstractRenderer
- Defined in:
- actionpack/lib/action_view/renderer/abstract_renderer.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
- #formats_regexp ⇒ Object
-
#initialize(lookup_context) ⇒ AbstractRenderer
constructor
A new instance of AbstractRenderer.
- #render ⇒ Object
-
#wrap_formats(value) ⇒ Object
Checks if the given path contains a format and if so, change the lookup context to take this new format into account.
Constructor Details
#initialize(lookup_context) ⇒ AbstractRenderer
Returns a new instance of AbstractRenderer.
6 7 8 |
# File 'actionpack/lib/action_view/renderer/abstract_renderer.rb', line 6 def initialize(lookup_context) @lookup_context = lookup_context end |
Instance Method Details
#formats_regexp ⇒ Object
26 27 28 |
# File 'actionpack/lib/action_view/renderer/abstract_renderer.rb', line 26 def formats_regexp @@formats_regexp ||= /\.(#{Mime::SET.symbols.join('|')})$/ end |
#render ⇒ Object
10 11 12 |
# File 'actionpack/lib/action_view/renderer/abstract_renderer.rb', line 10 def render raise NotImplementedError end |
#wrap_formats(value) ⇒ Object
Checks if the given path contains a format and if so, change the lookup context to take this new format into account.
16 17 18 19 20 21 22 23 24 |
# File 'actionpack/lib/action_view/renderer/abstract_renderer.rb', line 16 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 |