about summary refs log tree commit diff
path: root/app/serializers/rest/privacy_policy_serializer.rb
blob: f0572e714d0e9acdfcebbd8a4e460db72dac6996 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

class REST::PrivacyPolicySerializer < ActiveModel::Serializer
  attributes :updated_at, :content

  def updated_at
    object.updated_at.iso8601
  end

  def content
    markdown.render(object.text % { domain: Rails.configuration.x.local_domain })
  end

  private

  def markdown
    @markdown ||= Redcarpet::Markdown.new(Redcarpet::Render::HTML, escape_html: true, no_images: true)
  end
end