Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 33 lines (26 sloc) 0.895 kB
b88f4ca @josevalim Clean up the house before moving in the new furniture.
josevalim authored
1 module ActionView
2 class AbstractRenderer #:nodoc:
38f7eba @amatsuda :update_details method no more exists on @lookup_context
amatsuda authored
3 delegate :find_template, :template_exists?, :with_fallbacks, :with_layout_format, :formats, :to => :@lookup_context
b88f4ca @josevalim Clean up the house before moving in the new furniture.
josevalim authored
4
eb327c1 @apotonick no @controller dependency in Renderers.
apotonick authored
5 def initialize(lookup_context)
d08f651 @josevalim Start abstracting the renderer.
josevalim authored
6 @lookup_context = lookup_context
b88f4ca @josevalim Clean up the house before moving in the new furniture.
josevalim authored
7 end
8
9 def render
10 raise NotImplementedError
11 end
12
119e9e2 @josevalim Get rid of update_details in favor of passing details to find_template.
josevalim authored
13 protected
2e487bc @rafaelfranca Whitespaces :scissors:
rafaelfranca authored
14
2e3eb25 @apotonick Allow both sym and array for details options in #render. using LC#reg…
apotonick authored
15 def extract_details(options)
700c583 @carlosantoniodasilva Improve and cleanup a bit partial renderer
carlosantoniodasilva authored
16 @lookup_context.registered_details.each_with_object({}) do |key, details|
2e3eb25 @apotonick Allow both sym and array for details options in #render. using LC#reg…
apotonick authored
17 next unless value = options[key]
2ed1797 @rafaelfranca Change more Array.wrap to Kernel#Array
rafaelfranca authored
18 details[key] = Array(value)
2e3eb25 @apotonick Allow both sym and array for details options in #render. using LC#reg…
apotonick authored
19 end
20 end
2e487bc @rafaelfranca Whitespaces :scissors:
rafaelfranca authored
21
940b577 @josevalim Add support to render :once.
josevalim authored
22 def instrument(name, options={})
23 ActiveSupport::Notifications.instrument("render_#{name}.action_view", options){ yield }
24 end
eb19ca3 @route Common behavior with adding formats to lookup_context for TemplateRen…
route authored
25
26 def prepend_formats(formats)
27 formats = Array(formats)
28 return if formats.empty? || @lookup_context.html_fallback_for_js
29 @lookup_context.formats = formats | @lookup_context.formats
30 end
b88f4ca @josevalim Clean up the house before moving in the new furniture.
josevalim authored
31 end
0d00d65 @spastorino Delegate freeze_formats to lookup_context
spastorino authored
32 end
Something went wrong with that request. Please try again.