diff options
author | Felipe Artur <felipefac@gmail.com> | 2018-08-16 21:53:33 +0300 |
---|---|---|
committer | Felipe Artur <felipefac@gmail.com> | 2018-08-31 21:32:48 +0300 |
commit | 5bc54ca425866c37f6cdf6448d8ae2dcbabea3bf (patch) | |
tree | df5971d723e3239fe86740d78873522f6667537a /app/serializers/diff_line_entity.rb | |
parent | 472f2d566633df6c1dee1f703b06958b9a0a2cd8 (diff) |
Use a serializer to render diff lines
Diffstat (limited to 'app/serializers/diff_line_entity.rb')
-rw-r--r-- | app/serializers/diff_line_entity.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/serializers/diff_line_entity.rb b/app/serializers/diff_line_entity.rb new file mode 100644 index 00000000000..2119a1017d3 --- /dev/null +++ b/app/serializers/diff_line_entity.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class DiffLineEntity < Grape::Entity + expose :line_code + expose :type + expose :old_line + expose :new_line + expose :text + expose :meta_positions, as: :meta_data + + expose :rich_text do |line| + line.rich_text || CGI.escapeHTML(line.text) + end +end |