Skip to content

Instantly share code, notes, and snippets.

@elberskirch
Created December 27, 2011 15:33
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 elberskirch/1524028 to your computer and use it in GitHub Desktop.
Save elberskirch/1524028 to your computer and use it in GitHub Desktop.
Rubygame Challenge #1 solution
#!/usr/bin/env ruby
# see http://www.therubygame.com/challenges/1/submissions for task
# input string: ABCDEFGHIJKLMNOPQRSTUVWXY
# output string: ABCDE-FGHIJ-KLMNO-PQRST-UVWXY
def generate_licence_key(q)
a = []
5.times do
a.push q.slice!(0,5)
end
n = a.join("-")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment