X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Frailties%2Flib%2Fconsole_with_helpers.rb;fp=vendor%2Frails%2Frailties%2Flib%2Fconsole_with_helpers.rb;h=be453a689611e32848f17026ceeda0b783bdd03e;hb=d115f2e23823271635bad69229a42cd8ac68debe;hp=0000000000000000000000000000000000000000;hpb=37cb670bf3ddde90b214e591f100ed4446469484;p=depot.git diff --git a/vendor/rails/railties/lib/console_with_helpers.rb b/vendor/rails/railties/lib/console_with_helpers.rb new file mode 100644 index 0000000..be453a6 --- /dev/null +++ b/vendor/rails/railties/lib/console_with_helpers.rb @@ -0,0 +1,26 @@ +class Module + def include_all_modules_from(parent_module) + parent_module.constants.each do |const| + mod = parent_module.const_get(const) + if mod.class == Module + send(:include, mod) + include_all_modules_from(mod) + end + end + end +end + +def helper(*helper_names) + returning @helper_proxy ||= Object.new do |helper| + helper_names.each { |h| helper.extend "#{h}_helper".classify.constantize } + end +end + +require_dependency 'application' + +class << helper + include_all_modules_from ActionView +end + +@controller = ApplicationController.new +helper :application rescue nil