-
-
Save ELI7VH/ef0101aae31acbe92872e1c3accb598e to your computer and use it in GitHub Desktop.
This file contains 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 map_dat_roman(roman_mapping, number, result = '') | |
if (number >= 1) | |
k,v = roman_mapping.find { |k, v| number / k >= 1 } | |
map_dat_roman(roman_mapping, number - k, result += v) | |
else | |
result | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment