Sha256: dc8652177acf450a40017d65b592660b4507320f6ae320e5b2936eae21f49bfe
Contents?: true
Size: 523 Bytes
Versions: 50
Compression:
Stored size: 523 Bytes
Contents
class Roman { def Roman() { Integer.metaClass.getRoman = {-> def romanMappings = [ 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" ] def roman = new String() def num = delegate romanMappings.each() { k, v -> while (num >= k) { roman += v num -= k } } roman } } }
Version data entries
50 entries across 25 versions & 1 rubygems