lib/cousin_roman.rb in cousin_roman-1.0.4 vs lib/cousin_roman.rb in cousin_roman-1.0.5
- old
+ new
@@ -36,6 +36,18 @@
'cd' => 400,
'cm' => 900,
}
FACTORS = ONES.merge(FIVES).merge(SUBTRACTIVES)
+
+ def self.literals_for_pow(pow)
+ one, five = ONES.keys[pow], FIVES.keys[pow]
+ subtractives = if pow.between? 0, 2
+ skeys = SUBTRACTIVES.keys
+ { 4 => skeys[pow*2], 9 => skeys[pow*2 + 1] }
+ else
+ nil
+ end
+
+ { one: one, five: five, subtractives: subtractives }
+ end
end