Flowdock
method

inject_into_module

Importance_2
v2_6_3 - Show latest stable - 0 notes - Class: Actions
  • 1_8_6_287
  • 1_8_7_72
  • 1_8_7_330
  • 1_9_1_378
  • 1_9_2_180
  • 1_9_3_125
  • 1_9_3_392
  • 2_1_10
  • 2_2_9
  • 2_4_6
  • 2_5_5
  • 2_6_3 (0)
  • What's this?
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
Show source
Register or log in to add new notes.