Sha256: 231002159129181375e7d70831b0496898e49aef44660f1c07169d8266848dc1

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

# Include ApplicationHelper into all controllers:
Mack.logger.info "Initializing helpers..."
# adding application_helper module into all defined controllers
if Object.const_defined?("ApplicationHelper")
  Mack.logger.warn("ApplicationHelper has been deprecated! Please use move it to Mack::ViewHelpers::ApplicationHelper instead.")
  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
  h.include_safely_into(Mack::Rendering::ViewTemplate)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mack-0.6.0 lib/initialization/helpers.rb
mack-0.6.0.1 lib/initialization/helpers.rb