numbers_in_words 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest +0 -1
- data/README +16 -2
- data/Rakefile +33 -3
- data/lib/numbers.rb +215 -192
- data/lib/numbers_in_words.rb +0 -1
- data/lib/words.rb +192 -197
- data/numbers_in_words.gemspec +12 -13
- data/spec/numbers_in_words_spec.rb +85 -81
- data/spec/words_in_numbers_spec.rb +108 -101
- metadata +38 -53
@@ -1,109 +1,113 @@
|
|
1
|
-
require 'lib/numbers_in_words'
|
2
|
-
describe Fixnum do
|
3
|
-
it "should print the digits 0-9 correctly" do
|
4
|
-
numbers = %w[zero one two three four five six seven eight nine ten]
|
5
|
-
10.times do |i|
|
6
|
-
puts i.in_words
|
7
|
-
i.in_words.should==numbers[i]
|
1
|
+
require './lib/numbers_in_words'
|
8
2
|
|
9
|
-
|
3
|
+
describe NumbersInWords::NumberGroup do
|
4
|
+
|
5
|
+
it "should split into group of three digit numbers" do
|
6
|
+
Numeric::NumberGroup.groups_of(1,3).should == {0=>1}
|
7
|
+
Numeric::NumberGroup.groups_of(12,3).should == {0=>12}
|
8
|
+
Numeric::NumberGroup.groups_of(123,3).should == {0=>123}
|
9
|
+
Numeric::NumberGroup.groups_of(1111,3).should == {3=>1,0=>111}
|
10
|
+
Numeric::NumberGroup.groups_of(87654,3).should == {3=>87,0=>654}
|
11
|
+
Numeric::NumberGroup.groups_of(1234567,3).should == {6=>1,3=>234,0=>567}
|
12
|
+
Numeric::NumberGroup.groups_of(123456789101112,3).should == {12=>123,9=>456,6=>789,3=>101,0=>112}
|
10
13
|
end
|
11
|
-
|
12
|
-
words = %w[eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen]
|
13
|
-
numbers = [11,12,13,14,15,16,17,18,19]
|
14
|
-
numbers.each_with_index do |number, index|
|
15
|
-
puts number.in_words
|
16
|
-
number.in_words.should==words[index]
|
14
|
+
end
|
17
15
|
|
16
|
+
describe NumbersInWords::LanguageWriterEnglish do
|
17
|
+
it "should display numbers grouped" do
|
18
|
+
count = 0
|
19
|
+
@writer = NumbersInWords::LanguageWriterEnglish.new(2111)
|
20
|
+
@writer.group_words(3) do |power, name, digits|
|
21
|
+
case count
|
22
|
+
when 0
|
23
|
+
power.should == 3
|
24
|
+
name.should == "thousand"
|
25
|
+
digits.should == 2
|
26
|
+
when 1
|
27
|
+
power.should == 0
|
28
|
+
name.should == "one"
|
29
|
+
digits.should == 111
|
30
|
+
end
|
31
|
+
count += 1
|
18
32
|
end
|
19
33
|
end
|
34
|
+
end
|
20
35
|
|
21
|
-
it "should return a hash of powers of ten" do
|
22
|
-
117.powers_of_ten.should == {0=>7,1=>1,2=>1}
|
23
|
-
0.powers_of_ten.should == {}
|
24
|
-
1.powers_of_ten.should == {0=>1}
|
25
|
-
9.powers_of_ten.should == {0=>9}
|
26
|
-
10.powers_of_ten.should == {1=>1}
|
27
|
-
18.powers_of_ten.should == {1=>1,0=>8}
|
28
|
-
123456.powers_of_ten.should == {0=>6,1=>5,2=>4,3=>3,4=>2,5=>1}
|
29
|
-
end
|
30
36
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
-10.in_words.should == "minus ten"
|
35
|
-
-15.in_words.should == "minus fifteen"
|
36
|
-
-100.in_words.should == "minus one hundred"
|
37
|
-
(-1*(10**100)).in_words.should == "minus one googol"
|
38
|
-
-123456789.in_words.should == "minus one hundred and twenty three million four hundred and fifty six thousand seven hundred and eighty nine"
|
39
|
-
end
|
37
|
+
describe NumbersInWords do
|
38
|
+
it "should print the digits 0-9 correctly" do
|
39
|
+
numbers = %w[zero one two three four five six seven eight nine]
|
40
40
|
|
41
|
-
|
42
|
-
#because of lack of absolute accuracy with floats
|
43
|
-
#the output won't be exactly as you might expect
|
44
|
-
#so we will match rather than find equivalents
|
45
|
-
1.1.in_words.should == "one point one"
|
46
|
-
1.2345678.in_words.should == "one point two three four five six seven eight"
|
47
|
-
1000.2345678.in_words.should match "one thousand point two three four five six seven eight"
|
48
|
-
12345.2345678.in_words.should match "twelve thousand three hundred and forty five point two three four five six seven eight"
|
49
|
-
(10**9 + 0.1).in_words.should match "one billion point one"
|
41
|
+
10.times { |i| i.in_words.should==numbers[i] }
|
50
42
|
end
|
51
43
|
|
52
|
-
it "should
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
87654.groups_of(3).should == {3=>87,0=>654}
|
58
|
-
1234567.groups_of(3).should == {6=>1,3=>234,0=>567}
|
59
|
-
123456789101112.groups_of(3).should == {12=>123,9=>456,6=>789,3=>101,0=>112}
|
60
|
-
end
|
44
|
+
it "should print the digits 11-19 correctly" do
|
45
|
+
words = %w[eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen]
|
46
|
+
numbers = [11,12,13,14,15,16,17,18,19]
|
47
|
+
numbers.each_with_index do |number, index|
|
48
|
+
number.in_words.should==words[index]
|
61
49
|
|
62
|
-
it "should display numbers grouped" do
|
63
|
-
2111.group_words 3 do |power, name, digits|
|
64
|
-
puts "10^#{power} #{name} #{ digits }"
|
65
50
|
end
|
66
51
|
end
|
67
52
|
|
68
53
|
it "should handle two digit numbers" do
|
69
|
-
21.in_words.should == "twenty one"
|
54
|
+
21.in_words. should == "twenty one"
|
70
55
|
end
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
56
|
+
|
57
|
+
it "should handle three digit numbers" do
|
58
|
+
113.in_words. should == "one hundred and thirteen"
|
59
|
+
299.in_words. should == "two hundred and ninety nine"
|
60
|
+
300.in_words. should == "three hundred"
|
61
|
+
101.in_words. should == "one hundred and one"
|
76
62
|
end
|
77
63
|
|
78
64
|
it "should print out some random examples correctly" do
|
79
|
-
2999.in_words.should == "two thousand nine hundred and ninety nine"
|
80
|
-
99999.in_words.should == "ninety nine thousand nine hundred and ninety nine"
|
81
|
-
999999.in_words.should == "nine hundred and ninety nine thousand nine hundred and ninety nine"
|
82
|
-
123456.in_words.should == "one hundred and twenty three thousand four hundred and fifty six"
|
83
|
-
17054.in_words.should == "seventeen thousand and fifty four"
|
84
|
-
11004.in_words.should == "eleven thousand and four"
|
85
|
-
470154.in_words.should == "four hundred and seventy thousand one hundred and fifty four"
|
86
|
-
417155.in_words.should == "four hundred and seventeen thousand one hundred and fifty five"
|
87
|
-
999999.in_words.should == "nine hundred and ninety nine thousand nine hundred and ninety nine"
|
88
|
-
1000000.in_words.should == "one million"
|
89
|
-
1000001.in_words.should == "one million and one"
|
90
|
-
112.in_words.should == "one hundred and twelve"
|
91
|
-
|
65
|
+
2999 .in_words. should == "two thousand nine hundred and ninety nine"
|
66
|
+
99999 .in_words. should == "ninety nine thousand nine hundred and ninety nine"
|
67
|
+
999999 .in_words. should == "nine hundred and ninety nine thousand nine hundred and ninety nine"
|
68
|
+
123456 .in_words. should == "one hundred and twenty three thousand four hundred and fifty six"
|
69
|
+
17054 .in_words. should == "seventeen thousand and fifty four"
|
70
|
+
11004 .in_words. should == "eleven thousand and four"
|
71
|
+
470154 .in_words. should == "four hundred and seventy thousand one hundred and fifty four"
|
72
|
+
417155 .in_words. should == "four hundred and seventeen thousand one hundred and fifty five"
|
73
|
+
999999 .in_words. should == "nine hundred and ninety nine thousand nine hundred and ninety nine"
|
74
|
+
1000000 .in_words. should == "one million"
|
75
|
+
1000001 .in_words. should == "one million and one"
|
76
|
+
112 .in_words. should == "one hundred and twelve"
|
92
77
|
end
|
93
78
|
|
94
79
|
it "should handle edge cases" do
|
95
|
-
1000001.in_words.should == "one million and one"
|
96
|
-
(10*10**12 + 10**6 +1).in_words.should == "ten trillion one million and one"
|
97
|
-
(10**75).in_words.should == "one quattuorvigintillion"
|
98
|
-
10001001.in_words.should == "ten million one thousand and one"
|
80
|
+
1000001 .in_words. should == "one million and one"
|
81
|
+
(10*10**12 + 10**6 +1) .in_words. should == "ten trillion one million and one"
|
82
|
+
(10**75) .in_words. should == "one quattuorvigintillion"
|
83
|
+
10001001 .in_words. should == "ten million one thousand and one"
|
99
84
|
end
|
85
|
+
|
100
86
|
it "should handle a googol and larger" do
|
101
87
|
n=10**100
|
102
|
-
|
103
|
-
(10**100 +
|
104
|
-
(42*10**100
|
105
|
-
(42* 10**100 * 10**100).in_words.should == "forty two googol googol"
|
88
|
+
(10**100 + 1) .in_words. should == "one googol and one"
|
89
|
+
(42*10**100 + 16777216).in_words. should == "forty two googol sixteen million seven hundred and seventy seven thousand two hundred and sixteen"
|
90
|
+
(42* 10**100 * 10**100).in_words. should == "forty two googol googol"
|
106
91
|
end
|
107
92
|
|
108
|
-
|
93
|
+
it "should handle negative numbers" do
|
94
|
+
-1 .in_words.should == "minus one"
|
95
|
+
-9 .in_words.should == "minus nine"
|
96
|
+
-10 .in_words.should == "minus ten"
|
97
|
+
-15 .in_words.should == "minus fifteen"
|
98
|
+
-100 .in_words.should == "minus one hundred"
|
99
|
+
(-1*(10**100)).in_words.should == "minus one googol"
|
100
|
+
-123456789 .in_words.should == "minus one hundred and twenty three million four hundred and fifty six thousand seven hundred and eighty nine"
|
101
|
+
end
|
109
102
|
|
103
|
+
it "should handle decimals" do
|
104
|
+
#because of lack of absolute accuracy with floats
|
105
|
+
#the output won't be exactly as you might expect
|
106
|
+
#so we will match rather than find equivalents
|
107
|
+
1.1 .in_words.should =~ /one point one/
|
108
|
+
1.2345678 .in_words.should =~ /one point two three four five six seven eight/
|
109
|
+
1000.2345678 .in_words.should =~ /one thousand point two three four five six seven eight/
|
110
|
+
12345.2345678.in_words.should =~ /twelve thousand three hundred and forty five point two three four five six seven eight/
|
111
|
+
(10**9 + 0.1).in_words.should =~ /one billion point one/
|
112
|
+
end
|
113
|
+
end
|
@@ -1,127 +1,134 @@
|
|
1
|
-
require 'lib/words'
|
1
|
+
require './lib/words'
|
2
|
+
|
2
3
|
describe WordsInNumbers do
|
3
4
|
it "should do the digits 0-10" do
|
4
|
-
"zero".in_numbers.should == 0
|
5
|
-
"one".in_numbers.should == 1
|
6
|
-
"two".in_numbers.should == 2
|
7
|
-
"three".in_numbers.should == 3
|
8
|
-
"four".in_numbers.should == 4
|
9
|
-
"five".in_numbers.should == 5
|
10
|
-
"six".in_numbers.should == 6
|
11
|
-
"seven".in_numbers.should == 7
|
12
|
-
"eight".in_numbers.should == 8
|
13
|
-
"nine".in_numbers.should == 9
|
5
|
+
"zero" .in_numbers.should == 0
|
6
|
+
"one" .in_numbers.should == 1
|
7
|
+
"two" .in_numbers.should == 2
|
8
|
+
"three" .in_numbers.should == 3
|
9
|
+
"four" .in_numbers.should == 4
|
10
|
+
"five" .in_numbers.should == 5
|
11
|
+
"six" .in_numbers.should == 6
|
12
|
+
"seven" .in_numbers.should == 7
|
13
|
+
"eight" .in_numbers.should == 8
|
14
|
+
"nine" .in_numbers.should == 9
|
14
15
|
end
|
16
|
+
|
15
17
|
it "should handle numbers for which there is one word" do
|
16
|
-
"ten".in_numbers.should == 10
|
17
|
-
"eleven".in_numbers.should == 11
|
18
|
-
"twelve".in_numbers.should == 12
|
19
|
-
"thirteen".in_numbers.should == 13
|
20
|
-
"fourteen".in_numbers.should == 14
|
21
|
-
"fifteen".in_numbers.should == 15
|
22
|
-
"sixteen".in_numbers.should == 16
|
23
|
-
"seventeen".in_numbers.should == 17
|
24
|
-
"eighteen".in_numbers.should == 18
|
25
|
-
"nineteen".in_numbers.should == 19
|
26
|
-
"twenty".in_numbers.should == 20
|
18
|
+
"ten" .in_numbers.should == 10
|
19
|
+
"eleven" .in_numbers.should == 11
|
20
|
+
"twelve" .in_numbers.should == 12
|
21
|
+
"thirteen" .in_numbers.should == 13
|
22
|
+
"fourteen" .in_numbers.should == 14
|
23
|
+
"fifteen" .in_numbers.should == 15
|
24
|
+
"sixteen" .in_numbers.should == 16
|
25
|
+
"seventeen" .in_numbers.should == 17
|
26
|
+
"eighteen" .in_numbers.should == 18
|
27
|
+
"nineteen" .in_numbers.should == 19
|
28
|
+
"twenty" .in_numbers.should == 20
|
27
29
|
end
|
30
|
+
|
28
31
|
it "should handle two word numbers up to 100" do
|
29
|
-
"twenty one".in_numbers.should == 21
|
30
|
-
"twenty two".in_numbers.should == 22
|
31
|
-
"twenty three".in_numbers.should == 23
|
32
|
-
"twenty four".in_numbers.should == 24
|
33
|
-
"twenty five".in_numbers.should == 25
|
34
|
-
"twenty six".in_numbers.should == 26
|
35
|
-
"twenty seven".in_numbers.should == 27
|
36
|
-
"twenty eight".in_numbers.should == 28
|
37
|
-
"seventy six".in_numbers.should == 76
|
38
|
-
"ninety nine".in_numbers.should == 99
|
32
|
+
"twenty one" .in_numbers.should == 21
|
33
|
+
"twenty two" .in_numbers.should == 22
|
34
|
+
"twenty three" .in_numbers.should == 23
|
35
|
+
"twenty four" .in_numbers.should == 24
|
36
|
+
"twenty five" .in_numbers.should == 25
|
37
|
+
"twenty six" .in_numbers.should == 26
|
38
|
+
"twenty seven" .in_numbers.should == 27
|
39
|
+
"twenty eight" .in_numbers.should == 28
|
40
|
+
"seventy six" .in_numbers.should == 76
|
41
|
+
"ninety nine" .in_numbers.should == 99
|
39
42
|
end
|
40
|
-
it "should handle hundreds" do
|
41
|
-
"one hundred".in_numbers.should == 100
|
42
|
-
"two hundred".in_numbers.should == 200
|
43
|
-
"three hundred".in_numbers.should == 300
|
44
|
-
"nine hundred".in_numbers.should == 900
|
45
|
-
"one hundred and seventy six".in_numbers.should == 176
|
46
|
-
"one hundred and seventy nine".in_numbers.should == 179
|
47
|
-
"nine hundred and ninety nine".in_numbers.should == 999
|
48
43
|
|
44
|
+
it "should handle hundreds" do
|
45
|
+
"one hundred" .in_numbers.should == 100
|
46
|
+
"two hundred" .in_numbers.should == 200
|
47
|
+
"three hundred" .in_numbers.should == 300
|
48
|
+
"nine hundred" .in_numbers.should == 900
|
49
|
+
"one hundred and seventy six" .in_numbers.should == 176
|
50
|
+
"one hundred and seventy nine" .in_numbers.should == 179
|
51
|
+
"nine hundred and ninety nine" .in_numbers.should == 999
|
49
52
|
end
|
53
|
+
|
50
54
|
it "should handle unusual hundreds" do
|
51
|
-
"eleven hundred".in_numbers.should == 1100
|
52
|
-
"twelve hundred".in_numbers.should == 1200
|
53
|
-
"thirteen hundred".in_numbers.should == 1300
|
54
|
-
"fifteen hundred".in_numbers.should == 1500
|
55
|
-
"nineteen hundred".in_numbers.should == 1900
|
55
|
+
"eleven hundred" .in_numbers.should == 1100
|
56
|
+
"twelve hundred" .in_numbers.should == 1200
|
57
|
+
"thirteen hundred" .in_numbers.should == 1300
|
58
|
+
"fifteen hundred" .in_numbers.should == 1500
|
59
|
+
"nineteen hundred" .in_numbers.should == 1900
|
56
60
|
|
57
61
|
end
|
58
62
|
it "should handle thousands" do
|
59
|
-
"two thousand and one".in_numbers.should == 2001
|
60
|
-
"one thousand".in_numbers.should == 1000
|
61
|
-
"two thousand".in_numbers.should == 2000
|
62
|
-
"three thousand".in_numbers.should == 3000
|
63
|
-
"nine thousand".in_numbers.should == 9000
|
64
|
-
"nine thousand two hundred".in_numbers.should == 9200
|
65
|
-
"nine thousand two hundred and seven".in_numbers.should == 9207
|
66
|
-
"nine thousand two hundred and ninety seven".in_numbers.should == 9297
|
67
|
-
|
63
|
+
"two thousand and one" .in_numbers .should == 2001
|
64
|
+
"one thousand" .in_numbers .should == 1000
|
65
|
+
"two thousand" .in_numbers .should == 2000
|
66
|
+
"three thousand" .in_numbers .should == 3000
|
67
|
+
"nine thousand" .in_numbers .should == 9000
|
68
|
+
"nine thousand two hundred" .in_numbers .should == 9200
|
69
|
+
"nine thousand two hundred and seven" .in_numbers .should == 9207
|
70
|
+
"nine thousand two hundred and ninety seven" .in_numbers .should == 9297
|
71
|
+
end
|
68
72
|
|
69
|
-
|
70
|
-
"one million".in_numbers.should == 1000000
|
71
|
-
"two googol five billion and seventy six".in_numbers.should == (2*10**100 + 5*10**9 + 76)
|
72
|
-
"thirty seven million".in_numbers.should == 37 * 10**6
|
73
|
-
"twenty six googol".in_numbers.should == 26 * 10**100
|
74
|
-
|
73
|
+
it "should handle larger numbers" do
|
74
|
+
"one million" .in_numbers .should == 1000000
|
75
|
+
"two googol five billion and seventy six" .in_numbers .should == (2*10**100 + 5*10**9 + 76)
|
76
|
+
"thirty seven million" .in_numbers .should == 37 * 10**6
|
77
|
+
"twenty six googol" .in_numbers .should == 26 * 10**100
|
78
|
+
end
|
75
79
|
|
76
80
|
it "should handle numbers in hundreds of thousands etc" do
|
77
|
-
"nine hundred thousand".in_numbers.should == 900000
|
78
|
-
"three hundred and fifty seven thousand".in_numbers.should == 357000
|
79
|
-
"five million three hundred and fifty seven thousand".in_numbers.should == 5357000
|
80
|
-
"nine hundred and ninety nine trillion".in_numbers.should == 999 * 10**12
|
81
|
-
|
82
|
-
|
83
|
-
"minus one".in_numbers.should == -1
|
84
|
-
"minus two googol".in_numbers.should == -2 * 10**100
|
85
|
-
"minus nine hundred and ninety nine trillion".in_numbers.should == -999 * 10**12
|
86
|
-
|
81
|
+
"nine hundred thousand" .in_numbers .should == 900000
|
82
|
+
"three hundred and fifty seven thousand" .in_numbers .should == 357000
|
83
|
+
"five million three hundred and fifty seven thousand" .in_numbers .should == 5357000
|
84
|
+
"nine hundred and ninety nine trillion" .in_numbers .should == 999 * 10**12
|
85
|
+
end
|
86
|
+
it "should handle negative numbers" do
|
87
|
+
"minus one" .in_numbers .should == -1
|
88
|
+
"minus two googol" .in_numbers .should == -2 * 10**100
|
89
|
+
"minus nine hundred and ninety nine trillion" .in_numbers .should == -999 * 10**12
|
90
|
+
end
|
87
91
|
|
88
|
-
|
89
|
-
"Minus one".in_numbers.should == -1
|
90
|
-
"FIVE Million, three hundred and fifty-seVen Thousand".in_numbers.should == 5357000
|
91
|
-
"FIVE,,./';';';[] Million, three hundred and fifty-seVen Thousand".in_numbers.should == 5357000
|
92
|
-
|
93
|
-
|
92
|
+
it "should ignore punctuation and capitalisation" do
|
93
|
+
"Minus one" .in_numbers .should == -1
|
94
|
+
"FIVE Million, three hundred and fifty-seVen Thousand" .in_numbers .should == 5357000
|
95
|
+
"FIVE,,./';';';[] Million, three hundred and fifty-seVen Thousand" .in_numbers .should == 5357000
|
96
|
+
|
97
|
+
end
|
94
98
|
|
95
99
|
it "should handle decimal points" do
|
96
|
-
"one point one".in_numbers.should == 1.1
|
100
|
+
"one point one" .in_numbers .should == 1.1
|
101
|
+
|
102
|
+
"zero point seven six five three four" .in_numbers .should == 0.76534
|
103
|
+
"one trillion point six" .in_numbers .should == 10**12 + 0.6
|
97
104
|
|
98
|
-
"zero point seven six five three four".in_numbers.should == 0.76534
|
99
|
-
"one trillion point six".in_numbers.should == 10**12 + 0.6
|
100
105
|
long_number = <<-NUMBER
|
101
|
-
nine duotrigintillion seven hundred and seventy seven untrigintillion
|
102
|
-
fifty nine trigintillion one hundred and sixty novemvigintillion
|
103
|
-
eight hundred and six octovigintillion seven hundred and thirty six
|
104
|
-
septenvigintillion four hundred and seventy one sexvigintillion
|
105
|
-
nine hundred and seventy quinvigintillion six hundred and thirty two
|
106
|
-
quattuorvigintillion eight hundred and twenty seven trevigintillion
|
107
|
-
eight hundred and thirty six duovigintillion nine hundred and fifty
|
108
|
-
two unvigintillion seven hundred and ten vigintillion eight hundred and one
|
109
|
-
novemdecillion nine hundred and forty eight octodecillion seven hundred
|
110
|
-
and five septendecillion six hundred and eighty three sexdecillion
|
111
|
-
one hundred and six quindecillion seven hundred and seven quattuordecillion
|
112
|
-
seven hundred and fifty seven tredecillion four hundred and twenty six
|
113
|
-
duodecillion seven hundred and ninety five undecillion seven hundred
|
114
|
-
and forty six decillion eight hundred and thirteen nonillion one hundred
|
115
|
-
and twenty seven octillion four hundred and sixty five septillion two
|
116
|
-
hundred and thirty seven sextillion one hundred and thirty nine
|
117
|
-
quintillion one hundred and fifty three quadrillion forty six
|
118
|
-
trillion seven hundred and fifty two billion eight hundred and three
|
106
|
+
nine duotrigintillion seven hundred and seventy seven untrigintillion
|
107
|
+
fifty nine trigintillion one hundred and sixty novemvigintillion
|
108
|
+
eight hundred and six octovigintillion seven hundred and thirty six
|
109
|
+
septenvigintillion four hundred and seventy one sexvigintillion
|
110
|
+
nine hundred and seventy quinvigintillion six hundred and thirty two
|
111
|
+
quattuorvigintillion eight hundred and twenty seven trevigintillion
|
112
|
+
eight hundred and thirty six duovigintillion nine hundred and fifty
|
113
|
+
two unvigintillion seven hundred and ten vigintillion eight hundred and one
|
114
|
+
novemdecillion nine hundred and forty eight octodecillion seven hundred
|
115
|
+
and five septendecillion six hundred and eighty three sexdecillion
|
116
|
+
one hundred and six quindecillion seven hundred and seven quattuordecillion
|
117
|
+
seven hundred and fifty seven tredecillion four hundred and twenty six
|
118
|
+
duodecillion seven hundred and ninety five undecillion seven hundred
|
119
|
+
and forty six decillion eight hundred and thirteen nonillion one hundred
|
120
|
+
and twenty seven octillion four hundred and sixty five septillion two
|
121
|
+
hundred and thirty seven sextillion one hundred and thirty nine
|
122
|
+
quintillion one hundred and fifty three quadrillion forty six
|
123
|
+
trillion seven hundred and fifty two billion eight hundred and three
|
119
124
|
million ninety three thousand seven hundred and ninety one point
|
120
125
|
eight nine five six four three two one eight nine five six seven eight
|
121
126
|
NUMBER
|
122
|
-
long_number.in_numbers.should ==
|
123
|
-
|
124
|
-
|
127
|
+
long_number.in_numbers.should ==
|
128
|
+
9777059160806736471970632827836952710801948705683106707757426795746813127465237139153046752803093791.89564321895678
|
129
|
+
|
130
|
+
"seventy five point eight four three two seven six nine four five one eight".
|
131
|
+
in_numbers.should == 75.84327694518
|
125
132
|
end
|
126
133
|
|
127
|
-
end
|
134
|
+
end
|
metadata
CHANGED
@@ -1,47 +1,38 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: numbers_in_words
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Mark Burns
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-04-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: active_support
|
16
|
+
requirement: &70207857965260 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
22
23
|
prerelease: false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
version: "0"
|
30
|
-
type: :development
|
31
|
-
version_requirements: *id001
|
32
|
-
description: "#in_words method for integers and #in_numbers for strings"
|
33
|
-
email: markthedeveloper@googlemail.com
|
24
|
+
version_requirements: *70207857965260
|
25
|
+
description: ! '#in_words method for integers and #in_numbers for strings'
|
26
|
+
email: markthedeveloper@gmail.com
|
34
27
|
executables: []
|
35
|
-
|
36
28
|
extensions: []
|
37
|
-
|
38
|
-
extra_rdoc_files:
|
29
|
+
extra_rdoc_files:
|
39
30
|
- CHANGELOG
|
40
31
|
- README
|
41
32
|
- lib/numbers.rb
|
42
33
|
- lib/numbers_in_words.rb
|
43
34
|
- lib/words.rb
|
44
|
-
files:
|
35
|
+
files:
|
45
36
|
- CHANGELOG
|
46
37
|
- Manifest
|
47
38
|
- README
|
@@ -51,44 +42,38 @@ files:
|
|
51
42
|
- lib/numbers.rb
|
52
43
|
- lib/numbers_in_words.rb
|
53
44
|
- lib/words.rb
|
54
|
-
- numbers_in_words.gemspec
|
55
45
|
- spec/numbers_in_words_spec.rb
|
56
46
|
- spec/words_in_numbers_spec.rb
|
57
|
-
|
47
|
+
- numbers_in_words.gemspec
|
58
48
|
homepage: http://rubygems.org/gems/numbers_in_words
|
59
49
|
licenses: []
|
60
|
-
|
61
50
|
post_install_message:
|
62
|
-
rdoc_options:
|
51
|
+
rdoc_options:
|
63
52
|
- --line-numbers
|
64
53
|
- --inline-source
|
65
54
|
- --title
|
66
55
|
- Numbers_in_words
|
67
56
|
- --main
|
68
57
|
- README
|
69
|
-
require_paths:
|
58
|
+
require_paths:
|
70
59
|
- lib
|
71
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
requirements:
|
80
|
-
- -
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
|
83
|
-
- 1
|
84
|
-
- 2
|
85
|
-
version: "1.2"
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '1.2'
|
86
72
|
requirements: []
|
87
|
-
|
88
73
|
rubyforge_project: numbers_in_words
|
89
|
-
rubygems_version: 1.
|
74
|
+
rubygems_version: 1.8.17
|
90
75
|
signing_key:
|
91
76
|
specification_version: 3
|
92
|
-
summary:
|
77
|
+
summary: ! 'Example: 123.in_words #=> "one hundred and twenty three", "seventy-five
|
78
|
+
point eight".in_numbers #=> 75.8'
|
93
79
|
test_files: []
|
94
|
-
|