Skip to content

Instantly share code, notes, and snippets.

@havenwood
Created November 30, 2019 21:21
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 havenwood/cb49427e01c65a419bdd5cc70daa1521 to your computer and use it in GitHub Desktop.
Save havenwood/cb49427e01c65a419bdd5cc70daa1521 to your computer and use it in GitHub Desktop.
require 'erb'
desc 'Scaffold out a module'
task :module, %i[name] do |_task, args|
template = ERB.new <<~END, trim_mode: '-'
module <%= args[:name] %>
<%- args.extras.each do |extra| %>
def <%= extra %>
:ok
end
<%- end %>
end
END
puts template.result binding
end
# rake "module[Cxl, wombat, foo]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment