Class: ActionPrompt::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/action_prompt/renderer.rb

Instance Method Summary collapse

Constructor Details

#initializeRenderer

Returns a new instance of Renderer.



3
4
5
# File 'lib/action_prompt/renderer.rb', line 3

def initialize
  # NOOP
end

Instance Method Details

#render(template_name, locals: {}) ⇒ Object



7
8
9
10
11
# File 'lib/action_prompt/renderer.rb', line 7

def render(template_name, locals: {})
  controller = ApplicationController.new
  controller.prepend_view_path(Rails.root.join("app", "prompts"))
  controller.render_to_string(template: template_name, locals: locals, layout: false)
end