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, &block) ⇒ Object
-
#initialize ⇒ Manager
constructor
A new instance of Manager.
- #override(name, &block) ⇒ Object
Constructor Details
#initialize ⇒ Manager
Returns a new instance of Manager.
10 11 12 13 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 10 def initialize @presets = {} define_default_preset end |
Instance Attribute Details
#presets ⇒ Object (readonly)
Returns the value of attribute presets.
8 9 10 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 8 def presets @presets end |
Instance Method Details
#[](name) ⇒ Object
29 30 31 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 29 def [](name) @presets[name] || {} end |
#default ⇒ Object
25 26 27 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 25 def default @presets[:default] || {} end |
#define(name, &block) ⇒ Object
15 16 17 18 19 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 15 def define(name, &block) preset = PresetBuilder.new preset.instance_eval(&block) @presets[name] = preset end |
#override(name, &block) ⇒ Object
21 22 23 |
# File 'lib/ckeditor5/rails/presets/manager.rb', line 21 def override(name, &block) @presets[name].instance_eval(&block) end |