lib/tuning/extensions/action_view/handlers.rb in tuning-4.0.1.1 vs lib/tuning/extensions/action_view/handlers.rb in tuning-4.0.1.2
- old
+ new
@@ -5,22 +5,18 @@
extend ActiveSupport::Concern
class Ruby
def call(template)
- <<-STRING
- output = begin
- #{template.source}
- end
- output#{suffix(template.type.symbol)}
- STRING
- end
-
- private
-
- def suffix(type)
- if %i(json xml).include?(type)
- ".to_#{type}"
+ if template.type.json?
+ <<-STRING
+ output = begin
+ #{template.source}
+ end
+ output.to_json
+ STRING
+ else
+ template.source
end
end
end
end