Class: CKEditor5::Rails::Context::PresetBuilder
- Inherits:
-
Object
- Object
- CKEditor5::Rails::Context::PresetBuilder
- Defined in:
- lib/ckeditor5/rails/context/preset_builder.rb
Overview
PresetBuilder provides functionality for building CKEditor 5 presets.
This class includes configuration and plugin handling methods from concerns and allows defining presets either through initialization blocks or method chaining.
Instance Method Summary collapse
-
#initialize(&block) ⇒ PresetBuilder
constructor
Initializes a new preset builder with optional configuration block.
-
#initialize_copy(source) ⇒ PresetBuilder
Creates a deep copy of the preset builder.
Methods included from Presets::Concerns::PluginMethods
#external_plugin, #inline_plugin, #plugin, #plugins
Methods included from Presets::Concerns::ConfigurationMethods
Constructor Details
#initialize(&block) ⇒ PresetBuilder
Initializes a new preset builder with optional configuration block
41 42 43 44 45 46 47 48 |
# File 'lib/ckeditor5/rails/context/preset_builder.rb', line 41 def initialize(&block) @disallow_inline_plugin_compression = true @config = { plugins: [] } instance_eval(&block) if block_given? end |
Instance Method Details
#initialize_copy(source) ⇒ PresetBuilder
Creates a deep copy of the preset builder
54 55 56 57 58 59 60 61 62 |
# File 'lib/ckeditor5/rails/context/preset_builder.rb', line 54 def initialize_copy(source) super @config = { plugins: source.config[:plugins].map(&:dup) }.merge( source.config.except(:plugins).deep_dup ) end |