Class: Refinery::Core::Engine

Inherits:
Rails::Engine
  • Object
show all
Includes:
Engine
Defined in:
lib/refinery/core/engine.rb

Class Method Summary collapse

Class Method Details

.load_decoratorsObject

Require/load (based on Rails app.config) all decorators from app/decorators/ and from registered plugins’ paths too.



12
13
14
15
16
17
18
# File 'lib/refinery/core/engine.rb', line 12

def load_decorators
  [Rails.root, Refinery::Plugins.registered.pathnames].flatten.map { |p|
    Dir[p.join('app', 'decorators', '**', '*_decorator.rb')]
  }.flatten.uniq.each do |decorator|
    Rails.application.config.cache_classes ? require(decorator) : load(decorator)
  end
end

.refinery_inclusion!Object

Performs the Refinery inclusion process which extends the currently loaded Rails applications with Refinery’s controllers and helpers. The process is wrapped by a before_inclusion and after_inclusion step that calls procs registered by the Refinery::Engine#before_inclusion and Refinery::Engine#after_inclusion class methods



24
25
26
27
28
29
30
31
# File 'lib/refinery/core/engine.rb', line 24

def refinery_inclusion!
  before_inclusion_procs.each(&:call)

  ::ApplicationController.send :include, Refinery::ApplicationController
  ::ApplicationController.send :helper, Refinery::Core::Engine.helpers

  after_inclusion_procs.each(&:call)
end