Created
April 12, 2016 03:13
-
-
Save LisaBee224/5e1219fba6b976ad7c7a831ce47ae09e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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