Skip to content

Instantly share code, notes, and snippets.

@LisaBee224
Created April 12, 2016 03:13
Show Gist options
  • Save LisaBee224/5e1219fba6b976ad7c7a831ce47ae09e to your computer and use it in GitHub Desktop.
Save LisaBee224/5e1219fba6b976ad7c7a831ce47ae09e to your computer and use it in GitHub Desktop.
def convert_to_roman(arabic, options={})
num = arabic
numeral = ""
$letters.each do |key,value|
numeral += value * (num/key)
num -= key * (num/key)
end
if options.has_key?(:modern) && options[:modern] == true
$modern_letters.each do |old_nums, new_nums|
numeral.sub!(old_nums, new_nums)
end
end
p numeral
end
convert_to_roman(204, {:modern => true})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment