Class: Rich::Cms::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/rich/cms/engine.rb

Defined Under Namespace

Classes: RichCmsError

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.current_controller=(value) ⇒ Object (writeonly)

Sets the attribute current_controller

Parameters:

  • value

    the value to set the attribute current_controller to.



10
11
12
# File 'lib/rich/cms/engine.rb', line 10

def current_controller=(value)
  @current_controller = value
end

.editable_contentObject (readonly)

Returns the value of attribute editable_content.



9
10
11
# File 'lib/rich/cms/engine.rb', line 9

def editable_content
  @editable_content
end

Class Method Details

.initObject



12
13
14
15
16
# File 'lib/rich/cms/engine.rb', line 12

def init
  @editable_content = {}
  append_to_load_path
  setup_assets
end

.register(*args) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/rich/cms/engine.rb', line 18

def register(*args)
  (editables = args.first.is_a?(Hash) ? args.first : Hash[*args]).each do |selector, specs|
    if @editable_content.keys.include?(selector)
      raise RichCmsError, "Already registered editable content identified with #{selector.inspect}"
    else
      @editable_content[selector] = Cms::Content::Group.build(selector, specs)
    end
  end
end