module Bundler::Thor::Actions
def inject_into_module(path, module_name, *args, &block)
end
" def help; 'help'; end\n"
inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper" do
inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper", " def help; 'help'; end\n"
==== Examples
config
data
module_name
path
==== Parameters
insert_into_file, it's reversible.
Injects text right after the module definition. Since it depends on
def inject_into_module(path, module_name, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} config[:after] = /module #{module_name}\n|module #{module_name} .*\n/ insert_into_file(path, *(args << config), &block) end