Sha256: 4d0f05c9ced7f4c528bfe26222ab8e7363e2c4bc636c2d4c9248a0583b97c166
Contents?: true
Size: 673 Bytes
Versions: 1
Compression:
Stored size: 673 Bytes
Contents
module Grape module Jbuilder class Renderer def initialize(view_path, template) @view_path, @template = view_path, template end def render(scope, locals = {}) unless view_path raise "Use Rack::Config to set 'api.tilt.root' in config.ru" end engine = ::Tilt.new file, nil, view_path: view_path engine.render scope, locals end private attr_reader :view_path, :template def file File.join view_path, template_with_extension end def template_with_extension template[/\.jbuilder$/] ? template : "#{template}.jbuilder" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
grape-jbuilder-0.2.0 | lib/grape/jbuilder/renderer.rb |