method

inject_into_module

ruby latest stable - Class: Bundler::Thor::Actions

Method not available on this version

This method is only available on newer versions. The first available version (v2_6_3) is shown here.

inject_into_module(path, module_name, *args, &block)
public

Injects text right after the module definition. Since it depends on insert_into_file, it’s reversible.

Parameters

path

path of the file to be changed

module_name<String|Class>

the module to be manipulated

data

the data to append to the class, can be also given as a block.

config

give :verbose => false to not log the status.

Examples

inject_into_module "app/helpers/application_helper.rb", ApplicationHelper, "  def help; 'help'; end\n"

inject_into_module "app/helpers/application_helper.rb", ApplicationHelper do
  "  def help; 'help'; end\n"
end