Class: ActionView::Template::Renderable
- Inherits:
-
Object
- Object
- ActionView::Template::Renderable
show all
- Defined in:
- lib/action_view/template/renderable.rb
Overview
Action View Renderable Template for objects that respond to #render_in
Instance Method Summary
collapse
Constructor Details
#initialize(renderable) ⇒ Renderable
7
8
9
|
# File 'lib/action_view/template/renderable.rb', line 7
def initialize(renderable)
@renderable = renderable
end
|
Instance Method Details
25
26
27
|
# File 'lib/action_view/template/renderable.rb', line 25
def format
@renderable.try(:format)
end
|
#identifier ⇒ Object
11
12
13
|
# File 'lib/action_view/template/renderable.rb', line 11
def identifier
@renderable.class.name
end
|
#render(context, *args) ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'lib/action_view/template/renderable.rb', line 15
def render(context, *args)
@renderable.render_in(context)
rescue NoMethodError
if !@renderable.respond_to?(:render_in)
raise ArgumentError, "'#{@renderable.inspect}' is not a renderable object. It must implement #render_in."
else
raise
end
end
|