Sha256: 1e8ea2de7552888c7956b8210df98a5442ec68a83adf7ab178f546c08436b83a

Contents?: true

Size: 1.8 KB

Versions: 11

Compression:

Stored size: 1.8 KB

Contents

require 'active_support/concern'

module Refinery
  module Engine
    extend ActiveSupport::Concern

    module ClassMethods
      def after_inclusion_procs #:nodoc:
        @@after_inclusion_procs ||= []
      end

      # 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
      #         engine_name :images
      #
      #         after_inclusion do
      #           # perform something here
      #         end
      #       end
      #     end
      #   end
      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

      def before_inclusion_procs #:nodoc:
        @@before_inclusion_procs ||= []
      end

      # 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
      #         engine_name :images
      #
      #         before_inclusion do
      #           # perform something here
      #         end
      #       end
      #     end
      #   end
      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
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
refinerycms-core-2.0.10 lib/refinery/engine.rb
refinerycms-core-2.0.9 lib/refinery/engine.rb
refinerycms-core-2.0.8 lib/refinery/engine.rb
refinerycms-core-2.0.7 lib/refinery/engine.rb
refinerycms-core-2.0.6 lib/refinery/engine.rb
refinerycms-core-2.0.5 lib/refinery/engine.rb
refinerycms-core-2.0.4 lib/refinery/engine.rb
refinerycms-core-2.0.3 lib/refinery/engine.rb
refinerycms-core-2.0.2 lib/refinery/engine.rb
refinerycms-core-2.0.1 lib/refinery/engine.rb
refinerycms-core-2.0.0 lib/refinery/engine.rb