Sha256: 5daae7554c7c4fb244d6e82c4af0dc5c4125cdce7bc26c30e3c6c488bdd17996

Contents?: true

Size: 1.67 KB

Versions: 17

Compression:

Stored size: 1.67 KB

Contents

module Refinery
  module Engine
    # 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
    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

    # 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
    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

    private
    def after_inclusion_procs
      @@after_inclusion_procs ||= []
    end

    def before_inclusion_procs
      @@before_inclusion_procs ||= []
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
refinerycms-core-4.0.3 lib/refinery/engine.rb
refinerycms-core-4.0.2 lib/refinery/engine.rb
refinerycms-core-4.0.1 lib/refinery/engine.rb
refinerycms-core-3.0.6 lib/refinery/engine.rb
refinerycms-core-4.0.0 lib/refinery/engine.rb
refinerycms-core-3.0.5 lib/refinery/engine.rb
refinerycms-core-3.0.4 lib/refinery/engine.rb
refinerycms-core-3.0.3 lib/refinery/engine.rb
refinerycms-core-3.0.2 lib/refinery/engine.rb
refinerycms-core-3.0.1 lib/refinery/engine.rb
refinerycms-core-3.0.0 lib/refinery/engine.rb
refinerycms-core-2.1.5 lib/refinery/engine.rb
refinerycms-core-2.1.4 lib/refinery/engine.rb
refinerycms-core-2.1.3 lib/refinery/engine.rb
refinerycms-core-2.1.2 lib/refinery/engine.rb
refinerycms-core-2.1.1 lib/refinery/engine.rb
refinerycms-core-2.1.0 lib/refinery/engine.rb