Module: Refinery::Engine

Included in:
Core::Engine, Images::Engine, Pages::Engine, Resources::Engine
Defined in:
core/lib/refinery/engine.rb

Instance Method Summary collapse

Instance Method Details

#after_inclusion(&block) ⇒ Object

Specify a block of code to be run after the refinery inclusion step. See Refinery::Core::Engine#refinery_inclusion for details regarding the Refinery inclusion process.

Example:

module Refinery
  module Images
    class Engine < Rails::Engine
      extend Refinery::Engine
      engine_name :images

      after_inclusion do
        # perform something here
      end
    end
  end
end


20
21
22
23
24
25
26
# File 'core/lib/refinery/engine.rb', line 20

def after_inclusion(&block)
  if block && block.respond_to?(:call)
    after_inclusion_procs << block
  else
    raise 'Anything added to be called after_inclusion must be callable (respond to #call).'
  end
end

#before_inclusion(&block) ⇒ Object

Specify a block of code to be run before the refinery inclusion step. See Refinery::Core::Engine#refinery_inclusion for details regarding the Refinery inclusion process.

Example:

module Refinery
  module Images
    class Engine < Rails::Engine
      extend Refinery::Engine
      engine_name :images

      before_inclusion do
        # perform something here
      end
    end
  end
end


45
46
47
48
49
50
51
# File 'core/lib/refinery/engine.rb', line 45

def before_inclusion(&block)
  if block && block.respond_to?(:call)
    before_inclusion_procs << block
  else
    raise 'Anything added to be called before_inclusion must be callable (respond to #call).'
  end
end