Sha256: 41ff5661895819be6795a0c1866b59b87bfb3d4ede664c506ea819258f79963a
Contents?: true
Size: 499 Bytes
Versions: 159
Compression:
Stored size: 499 Bytes
Contents
module BookKeeping VERSION = 2 end class Integer def to_roman i = self s = '' roman_mappings.each do |arabic, roman| while i >= arabic s << roman i -= arabic end end s end def roman_mappings { 1000 => 'M', 900 => 'CM', 500 => 'D', 400 => 'CD', 100 => 'C', 90 => 'XC', 50 => 'L', 40 => 'XL', 10 => 'X', 9 => 'IX', 5 => 'V', 4 => 'IV', 1 => 'I' } end end
Version data entries
159 entries across 159 versions & 1 rubygems