Class: CKEditor5::Rails::Presets::Manager
- Inherits:
-
Object
- Object
- CKEditor5::Rails::Presets::Manager
- Defined in:
- lib/ckeditor5/rails/presets/manager.rb
Instance Attribute Summary collapse
-
#presets ⇒ Object
readonly
Returns the value of attribute presets.
Instance Method Summary collapse
- #[](name) ⇒ Object
- #default ⇒ Object
- #define(name, inherit: true, &block) ⇒ Object
-
#initialize ⇒ Manager
constructor
A new instance of Manager.
- #override(name, &block) ⇒ Object (also: #extend)
Constructor Details
#initialize ⇒ Manager
Returns a new instance of Manager.
11 12 13 14 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 11 def initialize @presets = {} define_default_preset end |
Instance Attribute Details
#presets ⇒ Object (readonly)
Returns the value of attribute presets.
9 10 11 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 9 def presets @presets end |
Instance Method Details
#[](name) ⇒ Object
37 38 39 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 37 def [](name) @presets[name] end |
#default ⇒ Object
33 34 35 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 33 def default @presets[:default] end |
#define(name, inherit: true, &block) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 16 def define(name, inherit: true, &block) preset = if inherit && default.present? default.clone else PresetBuilder.new end preset.instance_eval(&block) @presets[name] = preset end |
#override(name, &block) ⇒ Object Also known as: extend
27 28 29 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 27 def override(name, &block) @presets[name].instance_eval(&block) end |