123456789_123456789_123456789_123456789_123456789_

Class: ActionView::Template::Renderable

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: actionview/lib/action_view/template/renderable.rb

Overview

Action View Renderable Template for objects that respond to #render_in

Class Method Summary

Instance Method Summary

Constructor Details

.new(renderable) ⇒ Renderable

[ GitHub ]

  
# File 'actionview/lib/action_view/template/renderable.rb', line 7

def initialize(renderable)
  @renderable = renderable
end

Instance Method Details

#format

[ GitHub ]

  
# File 'actionview/lib/action_view/template/renderable.rb', line 25

def format
  @renderable.try(:format)
end

#identifier

[ GitHub ]

  
# File 'actionview/lib/action_view/template/renderable.rb', line 11

def identifier
  @renderable.class.name
end

#render(context, *args)

[ GitHub ]

  
# File 'actionview/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