centurian 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/lib/centurian.rb +3 -2
- data/lib/centurian/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 112cc48acfd522d1b9ace4060d88947ca2d7eca8
|
4
|
+
data.tar.gz: b4ace04e80d613f221041da4343def3f06113b99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 502a80649c82b09c44670bb2caa66bfeeb56f8d7c70d31d3095b865a75c5b6f593895b5b17c1f3727c18bafbb8326b9946b1f8d71c76c52400e138ed1d8c719c
|
7
|
+
data.tar.gz: 9016cb6a92bbafab23210ee85ef80fa653bbb37e6a27e18403ea4d1ac02188218c393b64a71a9607c22a82092e07e23562ec6855f43d5a3e1c28bbbcaa469bce
|
data/Gemfile
CHANGED
data/lib/centurian.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
require "centurian/version"
|
2
2
|
|
3
3
|
module Centurian
|
4
|
-
ROMAN = {M: 1000, CM: 900, D: 500, CD: 400, C: 100, XC: 90, L: 50, XL: 40, X:10, IX: 9, V:5, IV: 4, I: 1}
|
4
|
+
ROMAN = {M: 1000, CM: 900, D: 500, CD: 400, C: 100, XC: 90, L: 50, XL: 40, X: 10, IX: 9, V: 5, IV: 4, I: 1}
|
5
5
|
|
6
6
|
def to_roman
|
7
|
+
number = self
|
7
8
|
ROMAN.reduce("") do |roman, (k, v)|
|
8
|
-
count, number =
|
9
|
+
count, number = number.divmod(v)
|
9
10
|
roman << (k.to_s * count)
|
10
11
|
end
|
11
12
|
end
|
data/lib/centurian/version.rb
CHANGED