2010-10-10 05:03:18 -04:00
|
|
|
module ActionView
|
|
|
|
class AbstractRenderer #:nodoc:
|
|
|
|
delegate :find_template, :template_exists?, :with_fallbacks, :update_details,
|
2010-10-16 11:42:19 -04:00
|
|
|
:with_layout_format, :formats, :freeze_formats, :to => :@lookup_context
|
2010-10-10 05:03:18 -04:00
|
|
|
|
2011-05-03 18:12:11 -04:00
|
|
|
def initialize(lookup_context)
|
2011-05-01 04:33:30 -04:00
|
|
|
@lookup_context = lookup_context
|
2010-10-10 05:03:18 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def render
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2011-09-22 09:03:05 -04:00
|
|
|
protected
|
2011-09-22 17:51:44 -04:00
|
|
|
|
|
|
|
def extract_details(options)
|
|
|
|
details = {}
|
|
|
|
@lookup_context.registered_details.each do |key|
|
|
|
|
next unless value = options[key]
|
2012-01-05 15:18:54 -05:00
|
|
|
details[key] = Array(value)
|
2011-09-22 17:51:44 -04:00
|
|
|
end
|
|
|
|
details
|
|
|
|
end
|
|
|
|
|
2010-10-10 06:34:31 -04:00
|
|
|
def instrument(name, options={})
|
|
|
|
ActiveSupport::Notifications.instrument("render_#{name}.action_view", options){ yield }
|
|
|
|
end
|
2010-10-10 05:03:18 -04:00
|
|
|
end
|
2010-10-16 11:39:11 -04:00
|
|
|
end
|