Sha256: 6178d6ffb47616467121ae61e6646acc89a8d815522393739b2d6089c18c6c22

Contents?: true

Size: 695 Bytes

Versions: 9

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module TermCustomizer
    # This class serializes a Proposal so can be exported to CSV, JSON or other
    # formats.
    class TranslationSerializer < Decidim::Exporters::Serializer
      # Public: Initializes the serializer with a proposal.
      def initialize(translation)
        @translation = translation
      end

      # Public: Exports a hash with the serialized data for this proposal.
      def serialize
        {
          id: translation.id,
          locale: translation.locale,
          key: translation.key,
          value: translation.value
        }
      end

      private

      attr_reader :translation
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
decidim-term_customizer-0.23.0 lib/decidim/term_customizer/translation_serializer.rb
decidim-term_customizer-0.22.0 lib/decidim/term_customizer/translation_serializer.rb
decidim-term_customizer-0.21.0 lib/decidim/term_customizer/translation_serializer.rb
decidim-term_customizer-0.20.0 lib/decidim/term_customizer/translation_serializer.rb
decidim-term_customizer-0.19.1 lib/decidim/term_customizer/translation_serializer.rb
decidim-term_customizer-0.19.0 lib/decidim/term_customizer/translation_serializer.rb
decidim-term_customizer-0.18.0 lib/decidim/term_customizer/translation_serializer.rb
decidim-term_customizer-0.17.1 lib/decidim/term_customizer/translation_serializer.rb
decidim-term_customizer-0.17.0 lib/decidim/term_customizer/translation_serializer.rb