Skip to content

Commit a557435

Browse files
committed
tally mark 5
1 parent 4f1cc90 commit a557435

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

config/initializers/extensions.rb

+9-5
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ class Fixnum
55
# starting with 10, use Roman
66
def tallyize
77
if self > 0
8-
ones = self % 5
9-
fives = self - ones
10-
"#{fives.romanize} #{'/' * ones}"
8+
ones = self % 10
9+
str = [ (self - ones).romanize ]
10+
if ones >= 5
11+
str << "/" << "\314\266/" * 3
12+
str << ' '
13+
ones -= 5
14+
end
15+
str << '/' * ones
16+
str.join('')
1117
else
1218
"0"
1319
end
@@ -23,8 +29,6 @@ def romanize
2329
str << s
2430
s, num = fives(num, 10, 'X', 'L', 'C')
2531
str << s
26-
s, num = fives(num, 1, 'I', 'V', 'X')
27-
str << s
2832

2933
str.join(' ')
3034
end

0 commit comments

Comments
 (0)