Sha256: 71f8cf70cc6e012e33200d848368831704555d73a6815e5d25e6abd4cf176d15

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

boot_load(:helpers, :logging) do
  # Include ApplicationHelper into all controllers:
  Mack.logger.debug "Initializing helpers..." unless app_config.log.disable_initialization_logging
  # adding application_helper module into all defined controllers
  if Object.const_defined?("ApplicationHelper")
    deprecate_method("ApplicationHelper", "Mack::ViewHelpers::ApplicationHelper", "0.7.0")
    ApplicationHelper.include_safely_into(Mack::Rendering::ViewTemplate)
  end

  module Mack
    module ControllerHelpers # :nodoc:
    end
  
    module ViewHelpers # :nodoc:
    end
  end

  # Find controller level Helpers and include them into their respective controllers
  Mack::ControllerHelpers.constants.each do |cont|
    h = "Mack::ControllerHelpers::#{cont}"
    if Object.const_defined?(cont)
      h.constantize.include_safely_into(cont.constantize)
    else
      Mack.logger.warn("Could not find: #{cont} controller for helper: #{h}")
    end
  end

  # Find view level Helpers and include them into the Mack::Rendering::ViewTemplate
  Mack::ViewHelpers.constants.each do |cont|
    h = "Mack::ViewHelpers::#{cont}".constantize
    Mack::Rendering::ViewTemplate.send(:include, h)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mack-0.7.1.1 lib/mack/initialization/helpers.rb
mack-0.7.1 lib/mack/initialization/helpers.rb