Skip to content

Instantly share code, notes, and snippets.

@vamdt
Created October 13, 2014 03:13
Show Gist options
  • Save vamdt/bc5bba732ce7c897f27f to your computer and use it in GitHub Desktop.
Save vamdt/bc5bba732ce7c897f27f to your computer and use it in GitHub Desktop.
Add module nest to ruby class
#!/usr/bin/env ruby
module_name = "Api"
files = Dir["*.rb"]
files.each do |file|
data = IO.read(file)
data.gsub!("\n", "\n ")
new_data = "module #{module_name}\n\n " + data + "\nend"
IO.write(file, new_data)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment