class Sliver::Rails::JBuilderRenderer
Attributes
locals[R]
template[R]
Public Class Methods
call(template, locals = {})
click to toggle source
# File lib/sliver/rails/jbuilder_renderer.rb, line 2 def self.call(template, locals = {}) new(template, locals).call end
new(template, locals = {})
click to toggle source
# File lib/sliver/rails/jbuilder_renderer.rb, line 6 def initialize(template, locals = {}) @template, @locals = template, locals end
Public Instance Methods
call()
click to toggle source
# File lib/sliver/rails/jbuilder_renderer.rb, line 10 def call engine.render Sliver::Rails.template_class.new, locals end
Private Instance Methods
engine()
click to toggle source
# File lib/sliver/rails/jbuilder_renderer.rb, line 18 def engine Tilt.new template_path, nil, view_path: views_path end
template_path()
click to toggle source
# File lib/sliver/rails/jbuilder_renderer.rb, line 22 def template_path template_with_ext = template template_with_ext = "#{template}.jbuilder" unless template[/\.jbuilder$/] File.join views_path, template_with_ext end
views_path()
click to toggle source
# File lib/sliver/rails/jbuilder_renderer.rb, line 29 def views_path Sliver::Rails.view_paths end