Skip to content

Instantly share code, notes, and snippets.

@UberMouse
Created April 10, 2014 04:49
Show Gist options
  • Save UberMouse/10343411 to your computer and use it in GitHub Desktop.
Save UberMouse/10343411 to your computer and use it in GitHub Desktop.
lines = []
File.open(ARGV[0]).each_line do |line|
lines << line
end
def word_to_num(word)
case word
when "zero" then 0
when "one" then 1
when "two" then 2
when "three" then 3
when "four" then 4
when "five" then 5
when "six" then 6
when "seven" then 7
when "eight" then 8
when "nine" then 9
end
end
lines.map{|l| l.split(";")}.each do |line|
puts line.map{|word| word_to_num(word)}.join
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment