lib/json_builder/template.rb in json_builder-3.0.2 vs lib/json_builder/template.rb in json_builder-3.0.3
- old
+ new
@@ -16,13 +16,15 @@
module ActionView
module TemplateHandlers
class JSONBuilder < TemplateHandler
include Compilable
- def compile(template)
- "::JSONBuilder::Compiler.generate(:scope => self, :pretty => ActionView::Base.pretty_print_json, :callback => ActionView::Base.json_callback) {#{template.source}};"
- end
+ def compile(template) %{
+ ::JSONBuilder::Compiler.generate(:scope => self, :pretty => ActionView::Base.pretty_print_json, :callback => ActionView::Base.json_callback) {
+ #{template.source}
+ }
+ } end
end
end
end
ActionView::Template.register_template_handler :json_builder, ActionView::TemplateHandlers::JSONBuilder
@@ -41,10 +43,14 @@
File.read(template.identifier)
else # use source
template.source
end
- "::JSONBuilder::Compiler.generate(:scope => self, :pretty => ActionView::Base.pretty_print_json, :callback => ActionView::Base.json_callback) {#{source}};"
+ %{
+ ::JSONBuilder::Compiler.generate(:scope => self, :pretty => ActionView::Base.pretty_print_json, :callback => ActionView::Base.json_callback) {
+ #{template.source}
+ }
+ }
end
end
end
end