Skip to content

Instantly share code, notes, and snippets.

@elliotcm
Created February 12, 2011 13:42
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 elliotcm/823765 to your computer and use it in GitHub Desktop.
Save elliotcm/823765 to your computer and use it in GitHub Desktop.
class Fixnum
def to_roman_numerals
tens, remainder = self.divmod(10)
fives, units = remainder.divmod(5)
('X'*tens) + ('V'*fives) + ('I'*units)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment