module Thor::Actions
def inject_into_class(path, klass, *args, &block)
end
" filter_parameter :password\n"
inject_into_class "app/controllers/application_controller.rb", ApplicationController do
inject_into_class "app/controllers/application_controller.rb", ApplicationController, " filter_parameter :password\n"
==== Examples
config
data
klass
path
==== Parameters
insert_into_file, it's reversible.
Injects text right after the class definition. Since it depends on
def inject_into_class(path, klass, *args, &block) config = args.last.is_a?(Hash) ? args.pop : {} config[:after] = /class #{klass}\n|class #{klass} .*\n/ insert_into_file(path, *(args << config), &block) end