lib/grape-rabl/formatter.rb in grape-rabl-0.3.0 vs lib/grape-rabl/formatter.rb in grape-rabl-0.3.1

- old
+ new

@@ -35,21 +35,24 @@ File.join(env['api.tilt.root'], (template + '.rabl')) end end def rablable? - !!endpoint.options[:route_options][:rabl] + !!rabl_template end def rabl - template = endpoint.options[:route_options][:rabl] - fail 'missing rabl template' unless template + fail 'missing rabl template' unless rabl_template set_view_root unless env['api.tilt.root'] - yield template + yield rabl_template end def locals - endpoint.options[:route_options][:rabl_locals] || {} + env['api.tilt.rabl_locals'] || endpoint.options[:route_options][:rabl_locals] || {} + end + + def rabl_template + env['api.tilt.rabl'] || endpoint.options[:route_options][:rabl] end def set_view_root fail "Use Rack::Config to set 'api.tilt.root' in config.ru" end