Sha256: 0a3c5b8379a3450056b460ef82d0769d2b62d94c0952398118bfdf8c52b7b2e3

Contents?: true

Size: 584 Bytes

Versions: 29

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

module CKEditor5::Rails
  module Context
    class PresetSerializer
      def initialize(preset)
        @preset = preset
      end

      def to_attributes
        {
          plugins: serialize_plugins,
          config: serialize_config
        }
      end

      private

      delegate :config, to: :@preset

      def serialize_plugins
        (config[:plugins] || []).map { |plugin| Editor::PropsBasePlugin.normalize(plugin).to_h }.to_json
      end

      def serialize_config
        config.except(:plugins).to_json
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/ckeditor5-1.24.9/lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.24.9 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.24.8 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.24.6 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.24.5 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.24.4 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.24.3 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.24.2 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.24.1 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.24.0 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.23.5 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.23.4 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.23.3 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.23.2 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.23.1 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.23.0 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.22.0 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.21.0 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.20.1 lib/ckeditor5/rails/context/preset_serializer.rb
ckeditor5-1.20.0 lib/ckeditor5/rails/context/preset_serializer.rb