Class: CKEditor5::Rails::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/ckeditor5/rails/engine.rb

Defined Under Namespace

Classes: ConfigurationProxy

Class Method Summary collapse

Class Method Details

.baseObject



44
45
46
# File 'lib/ckeditor5/rails/engine.rb', line 44

def base
  config.ckeditor5
end

.configure(&block) ⇒ Object



56
57
58
59
# File 'lib/ckeditor5/rails/engine.rb', line 56

def configure(&block)
  proxy = ConfigurationProxy.new(config.ckeditor5)
  proxy.instance_eval(&block)
end

.default_presetObject



48
49
50
# File 'lib/ckeditor5/rails/engine.rb', line 48

def default_preset
  config.ckeditor5.presets.default
end

.find_preset(preset) ⇒ Object



61
62
63
64
65
# File 'lib/ckeditor5/rails/engine.rb', line 61

def find_preset(preset)
  return preset if preset.is_a?(Presets::PresetBuilder)

  base.presets[preset]
end

.find_preset!(preset) ⇒ Object



67
68
69
70
71
72
# File 'lib/ckeditor5/rails/engine.rb', line 67

def find_preset!(preset)
  found_preset = find_preset(preset)
  return found_preset if found_preset.present?

  raise PresetNotFoundError, "Preset '#{preset}' not found. Please define it in the initializer."
end

.presetsObject



52
53
54
# File 'lib/ckeditor5/rails/engine.rb', line 52

def presets
  config.ckeditor5.presets
end