Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add module nest to ruby class
#!/usr/bin/env ruby
module_name = "Api"
files = Dir["*.rb"]
files.each do |file|
data =
data.gsub!("\n", "\n ")
new_data = "module #{module_name}\n\n " + data + "\nend"
IO.write(file, new_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.