Skip to content

Instantly share code, notes, and snippets.

@daveharris
Created February 19, 2014 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daveharris/9103994 to your computer and use it in GitHub Desktop.
Save daveharris/9103994 to your computer and use it in GitHub Desktop.
Add "Module MyModule" to all ruby files
Dir["**/*.rb"].each do |file|
contents = IO.readlines(file)
open(file, "w") do |f|
f.puts "module MyModule\n"
contents.each { |line| f.write " #{line}" }
f.puts "\nend"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment