numbers_in_words 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1 @@
1
+ v0.1.0. Handles decimals
data/Manifest CHANGED
@@ -1,14 +1,12 @@
1
+ CHANGELOG
1
2
  Manifest
2
3
  README
3
4
  Rakefile
4
5
  examples/display_numbers_in_words.rb
5
- index_cyclo.html
6
6
  init.rb
7
7
  lib/numbers.rb
8
8
  lib/numbers_in_words.rb
9
- lib/numbers_in_words.rb_cyclo.html
10
9
  lib/words.rb
11
- lib/words_in_numbers.rb_cyclo.html
12
10
  numbers_in_words.gemspec
13
11
  spec/numbers_in_words_spec.rb
14
12
  spec/words_in_numbers_spec.rb
data/Rakefile CHANGED
@@ -1,9 +1,9 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
- Echoe.new('numbers_in_words','0.0.9') do |e|
4
+ Echoe.new('numbers_in_words','0.1.0') do |e|
5
5
  e.description = "#in_words method for integers and #in_numbers for strings"
6
- e.summary = "Example: 123.in_words #=> \"one hundred and twenty three\", \"seventy-five\".in_numbers #=> 75"
6
+ e.summary = "Example: 123.in_words #=> \"one hundred and twenty three\", \"seventy-five point eight\".in_numbers #=> 75.8"
7
7
  e.url = "http://rubygems.org/gems/numbers_in_words"
8
8
  e.author = "Mark Burns"
9
9
  e.email = "markthedeveloper@googlemail.com"
data/lib/numbers.rb CHANGED
@@ -158,16 +158,41 @@ module NumbersInWords
158
158
  return output
159
159
  end
160
160
 
161
+ def handle_decimal value
162
+ if value.is_a? Float
163
+ int = value.to_i
164
+ decimal = value - int
165
+ return int.in_english + " point " + decimal_portion(decimal)
166
+ end
167
+ return nil
168
+ end
169
+
170
+ def decimal_portion decimal
171
+ decimal = decimal.to_s.split(".")[1]
172
+ digits = decimal.to_s.split //
173
+ out= digits.inject([]) {|out, digit|
174
+ out<< digit.to_i.in_english
175
+ out
176
+ }
177
+ out.join " "
178
+
179
+ end
180
+
161
181
  def in_english
182
+ #decimals
183
+ d= handle_decimal(self)
184
+ return d unless d.nil?
185
+
186
+
162
187
  number = self.to_i # make a copy
163
- #handle negative numbers
164
- if number < 0
165
- return "minus " + (-number).in_english
166
- end
188
+ #negative numbers
189
+ return "minus " + (-number).in_english if number < 0
190
+
167
191
  #handle 0-10
168
192
  return DIGITS[number] if number < 10
169
193
  return EXCEPTIONS[number] if EXCEPTIONS[number]
170
194
 
195
+ #longer numbers
171
196
  output = ""
172
197
  length = number.to_s.length
173
198
  if length == 2 #20-99
@@ -206,3 +231,7 @@ end
206
231
  class Bignum
207
232
  include NumbersInWords
208
233
  end
234
+
235
+ class Float
236
+ include NumbersInWords
237
+ end
data/lib/words.rb CHANGED
@@ -64,133 +64,160 @@ module WordsInNumbers
64
64
  "googol"=> 100
65
65
  }
66
66
 
67
- def in_numbers
68
- #easy single word case
69
- text = self.to_s
67
+ def strip_punctuation text
68
+ #ignore punctuation
70
69
  text.downcase!
71
70
  text.gsub! /[^a-z ]/, " "
72
71
  to_remove = true
73
72
  until to_remove.nil?
74
73
  to_remove=text.gsub! " ", " " until to_remove.nil?
75
74
  end
75
+ return text
76
+ end
77
+
78
+ def decimal_portion text
79
+ words = text.split " "
80
+ integers = word_array_to_integers words
81
+ decimal = "0." + integers.join()
82
+ decimal.to_f
83
+ end
76
84
 
85
+ def in_numbers
86
+ text = self.to_s
87
+ text = strip_punctuation text
88
+ #negative numbers
77
89
  if text =~ /^minus /
78
90
  return -1 * (text.gsub(/^minus /, "")).in_numbers
79
91
  end
92
+
93
+ #easy single word case
80
94
  word = word_to_integer(text)
81
95
  return word unless word.nil?
96
+
97
+ #decimals
98
+ match = text.match(/\spoint\s/)
99
+ if match
100
+ integer = match.pre_match
101
+ integer = integer.in_numbers
102
+
103
+ decimal = match.post_match
104
+ decimal = decimal_portion(decimal)
105
+ return integer + decimal
106
+ end
107
+
108
+ #multiple word case
82
109
  words = text.split " "
83
110
  integers = word_array_to_integers words
84
111
 
85
112
  i= parse_numbers(integers)
86
113
  return i unless i.nil?
87
114
  return nil
88
- end
89
-
90
-
91
- # Example: 364,895,457,898
92
- #three hundred and sixty four billion eight hundred and ninety five million
93
- #four hundred and fifty seven thousand eight hundred and ninety eight
94
- #
95
- #3 100 60 4 10^9, 8 100 90 5 10^6, 4 100 50 7 1000, 8 100 90 8
96
- # memory answer
97
- #x1. 3 add to memory because answer and memory are zero 3 0
98
- #x2. memory * 100 (because memory<100) 300 0
99
- #x3. 60 add to memory because memory > 60 360 0
100
- #x3. 4 add to memory because memory > 4 364 0
101
- #x4. multiply memory by 10^9 because memory < power of ten 364*10^9 0
102
- #x5. add memory to answer (and reset)memory > 8 (memory pow of ten > 2) 0 364*10^9
103
- #x6. 8 add to memory because not finished 8 ''
104
- #x7. multiply memory by 100 because memory < 100 800 ''
105
- #x8. add 90 to memory because memory > 90 890 ''
106
- #x9. add 5 to memory because memory > 5 895 ''
107
- #x10. multiply memory by 10^6 because memory < power of ten 895*10^6 ''
108
- #x11. add memory to answer (and reset) because memory power ten > 2 0 364895 * 10^6
109
- #x12. 4 add to memory because not finished 4 ''
110
- #x13. memory * 100 because memory < 100 400 ''
111
- #x14. memory + 50 because memory > 50 450 ''
112
- #x15. memory + 7 because memory > 7 457 ''
113
- #x16. memory * 1000 because memory < 1000 457000 ''
114
- #x17. add memory to answer (and reset)memory > 8 (memory pow of ten > 2) 0 364895457000
115
- #x18. 8 add to memory because not finished 8 ''
116
- #x19. memory * 100 because memory < 100 800 ''
117
- #x14. memory + 90 because memory > 90 890 ''
118
- #x15. memory + 8 because memory > 8 898 ''
119
- #16. finished so add memory to answer
120
-
121
- #Example
122
- #2001
123
- #two thousand and one
124
- #2 1000 1
125
- # memory answer
126
- #1. add 2 to memory because first 2 0
127
- #2. multiply memory by 1000 because memory < 1000 2000 0
128
- #3. add memory to answer,reset, because power of ten>2 0 2000
129
- #4. add 1 to memory 1 2000
130
- #5. finish - add memory to answer 0 2001
131
- def parse_numbers(integers)
132
- memory = 0
133
- answer = 0
134
- reset = true #reset each time memory is reset
135
- integers.each_with_index do |i, index|
136
- if reset
137
- reset = false
138
- memory += i
139
- else
140
- #x4. multiply memory by 10^9 because memory < power of ten
141
- if is_power_of_ten?(i)
142
- if power_of_ten(i)> 2
143
- memory *= i
144
- #17. add memory to answer (and reset) (memory pow of ten > 2)
145
- answer += memory
146
- memory = 0
147
- reset = true
148
- end
149
- end
150
-
151
- if memory < i
152
- memory *= i
153
- else
154
- memory += i
155
- end
156
- end
157
- end
158
- answer += memory
159
- end
160
-
161
- def power_of_ten integer
162
- Math.log10(integer)
163
- end
164
-
165
- def is_power_of_ten? integer
166
- power_of_ten(integer)==power_of_ten(integer).to_i
167
- end
168
-
169
- #handles simple single word numbers
170
- #e.g. one, seven, twenty, eight, thousand etc
171
- def word_to_integer word
172
- text = word.to_s.chomp.strip
173
- #digits 0-9
174
- digit = DIGITS.index(text)
175
- return digit unless digit.nil?
176
-
177
- #digits which are exceptions
178
- exception = EXCEPTIONS[text]
179
- return exception unless exception.nil?
180
-
181
- power = POWERS_OF_TEN[text]
182
- return 10**power unless power.nil?
183
- return nil
184
- end
185
-
186
- def word_array_to_integers words
187
- out = []
188
- words.map do |i|
189
- word = word_to_integer(i)
190
- out << word unless word.nil?
191
- end
192
- return out
193
- end
115
+ end
116
+
117
+
118
+ # Example: 364,895,457,898
119
+ #three hundred and sixty four billion eight hundred and ninety five million
120
+ #four hundred and fifty seven thousand eight hundred and ninety eight
121
+ #
122
+ #3 100 60 4 10^9, 8 100 90 5 10^6, 4 100 50 7 1000, 8 100 90 8
123
+ # memory answer
124
+ #x1. 3 add to memory because answer and memory are zero 3 0
125
+ #x2. memory * 100 (because memory<100) 300 0
126
+ #x3. 60 add to memory because memory > 60 360 0
127
+ #x3. 4 add to memory because memory > 4 364 0
128
+ #x4. multiply memory by 10^9 because memory < power of ten 364*10^9 0
129
+ #x5. add memory to answer (and reset)memory > 8 (memory pow of ten > 2) 0 364*10^9
130
+ #x6. 8 add to memory because not finished 8 ''
131
+ #x7. multiply memory by 100 because memory < 100 800 ''
132
+ #x8. add 90 to memory because memory > 90 890 ''
133
+ #x9. add 5 to memory because memory > 5 895 ''
134
+ #x10. multiply memory by 10^6 because memory < power of ten 895*10^6 ''
135
+ #x11. add memory to answer (and reset) because memory power ten > 2 0 364895 * 10^6
136
+ #x12. 4 add to memory because not finished 4 ''
137
+ #x13. memory * 100 because memory < 100 400 ''
138
+ #x14. memory + 50 because memory > 50 450 ''
139
+ #x15. memory + 7 because memory > 7 457 ''
140
+ #x16. memory * 1000 because memory < 1000 457000 ''
141
+ #x17. add memory to answer (and reset)memory > 8 (memory pow of ten > 2) 0 364895457000
142
+ #x18. 8 add to memory because not finished 8 ''
143
+ #x19. memory * 100 because memory < 100 800 ''
144
+ #x14. memory + 90 because memory > 90 890 ''
145
+ #x15. memory + 8 because memory > 8 898 ''
146
+ #16. finished so add memory to answer
147
+
148
+ #Example
149
+ #2001
150
+ #two thousand and one
151
+ #2 1000 1
152
+ # memory answer
153
+ #1. add 2 to memory because first 2 0
154
+ #2. multiply memory by 1000 because memory < 1000 2000 0
155
+ #3. add memory to answer,reset, because power of ten>2 0 2000
156
+ #4. add 1 to memory 1 2000
157
+ #5. finish - add memory to answer 0 2001
158
+ def parse_numbers(integers)
159
+ memory = 0
160
+ answer = 0
161
+ reset = true #reset each time memory is reset
162
+ integers.each_with_index do |i, index|
163
+ if reset
164
+ reset = false
165
+ memory += i
166
+ else
167
+ #x4. multiply memory by 10^9 because memory < power of ten
168
+ if is_power_of_ten?(i)
169
+ if power_of_ten(i)> 2
170
+ memory *= i
171
+ #17. add memory to answer (and reset) (memory pow of ten > 2)
172
+ answer += memory
173
+ memory = 0
174
+ reset = true
175
+ end
176
+ end
177
+
178
+ if memory < i
179
+ memory *= i
180
+ else
181
+ memory += i
182
+ end
183
+ end
184
+ end
185
+ answer += memory
186
+ end
187
+
188
+ def power_of_ten integer
189
+ Math.log10(integer)
190
+ end
191
+
192
+ def is_power_of_ten? integer
193
+ power_of_ten(integer)==power_of_ten(integer).to_i
194
+ end
195
+
196
+ #handles simple single word numbers
197
+ #e.g. one, seven, twenty, eight, thousand etc
198
+ def word_to_integer word
199
+ text = word.to_s.chomp.strip
200
+ #digits 0-9
201
+ digit = DIGITS.index(text)
202
+ return digit unless digit.nil?
203
+
204
+ #digits which are exceptions
205
+ exception = EXCEPTIONS[text]
206
+ return exception unless exception.nil?
207
+
208
+ power = POWERS_OF_TEN[text]
209
+ return 10**power unless power.nil?
210
+ return nil
211
+ end
212
+
213
+ def word_array_to_integers words
214
+ out = []
215
+ words.map do |i|
216
+ word = word_to_integer(i)
217
+ out << word unless word.nil?
218
+ end
219
+ return out
220
+ end
194
221
  end
195
222
 
196
223
  class String
@@ -2,21 +2,21 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{numbers_in_words}
5
- s.version = "0.0.9"
5
+ s.version = "0.1.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Mark Burns"]
9
9
  s.date = %q{2010-04-06}
10
10
  s.description = %q{#in_words method for integers and #in_numbers for strings}
11
11
  s.email = %q{markthedeveloper@googlemail.com}
12
- s.extra_rdoc_files = ["README", "lib/numbers.rb", "lib/numbers_in_words.rb", "lib/numbers_in_words.rb_cyclo.html", "lib/words.rb", "lib/words_in_numbers.rb_cyclo.html"]
13
- s.files = ["Manifest", "README", "Rakefile", "examples/display_numbers_in_words.rb", "index_cyclo.html", "init.rb", "lib/numbers.rb", "lib/numbers_in_words.rb", "lib/numbers_in_words.rb_cyclo.html", "lib/words.rb", "lib/words_in_numbers.rb_cyclo.html", "numbers_in_words.gemspec", "spec/numbers_in_words_spec.rb", "spec/words_in_numbers_spec.rb"]
12
+ s.extra_rdoc_files = ["CHANGELOG", "README", "lib/numbers.rb", "lib/numbers_in_words.rb", "lib/words.rb"]
13
+ s.files = ["CHANGELOG", "Manifest", "README", "Rakefile", "examples/display_numbers_in_words.rb", "init.rb", "lib/numbers.rb", "lib/numbers_in_words.rb", "lib/words.rb", "numbers_in_words.gemspec", "spec/numbers_in_words_spec.rb", "spec/words_in_numbers_spec.rb"]
14
14
  s.homepage = %q{http://rubygems.org/gems/numbers_in_words}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Numbers_in_words", "--main", "README"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{numbers_in_words}
18
18
  s.rubygems_version = %q{1.3.6}
19
- s.summary = %q{Example: 123.in_words #=> "one hundred and twenty three", "seventy-five".in_numbers #=> 75}
19
+ s.summary = %q{Example: 123.in_words #=> "one hundred and twenty three", "seventy-five point eight".in_numbers #=> 75.8}
20
20
 
21
21
  if s.respond_to? :specification_version then
22
22
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -37,13 +37,18 @@ describe Fixnum do
37
37
  (-1*(10**100)).in_words.should == "minus one googol"
38
38
  -123456789.in_words.should == "minus one hundred and twenty three million four hundred and fifty six thousand seven hundred and eighty nine"
39
39
  end
40
+
40
41
  it "should handle decimals" do
41
- pending
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
42
45
  1.1.in_words.should == "one point one"
43
46
  1.2345678.in_words.should == "one point two three four five six seven eight"
44
- 1000.2345678.in_words.should == "one thousand point two three four five six seven eight"
45
- 12345.2345678.in_words.should == "twelve thousand three hundred and forty five 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"
46
50
  end
51
+
47
52
  it "should split into group of three digit numbers" do
48
53
  1.groups_of(3).should == {0=>1}
49
54
  12.groups_of(3).should == {0=>12}
@@ -1,4 +1,4 @@
1
- require 'lib/words_in_numbers'
1
+ require 'lib/words'
2
2
  describe WordsInNumbers do
3
3
  it "should do the digits 0-10" do
4
4
  "zero".in_numbers.should == 0
@@ -89,6 +89,39 @@ describe WordsInNumbers do
89
89
  "Minus one".in_numbers.should == -1
90
90
  "FIVE Million, three hundred and fifty-seVen Thousand".in_numbers.should == 5357000
91
91
  "FIVE,,./';';';[] Million, three hundred and fifty-seVen Thousand".in_numbers.should == 5357000
92
+
93
+ end
94
+
95
+ it "should handle decimal points" do
96
+ "one point one".in_numbers.should == 1.1
92
97
 
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
+ 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
119
+ million ninety three thousand seven hundred and ninety one point
120
+ eight nine five six four three two one eight nine five six seven eight
121
+ NUMBER
122
+ long_number.in_numbers.should == 9777059160806736471970632827836952710801948705683106707757426795746813127465237139153046752803093791.89564321895678
123
+ "seventy five point eight four three two seven six nine four five one eight".in_numbers.should ==
124
+ 75.84327694518
93
125
  end
126
+
94
127
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 9
9
- version: 0.0.9
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mark Burns
@@ -36,24 +36,21 @@ executables: []
36
36
  extensions: []
37
37
 
38
38
  extra_rdoc_files:
39
+ - CHANGELOG
39
40
  - README
40
41
  - lib/numbers.rb
41
42
  - lib/numbers_in_words.rb
42
- - lib/numbers_in_words.rb_cyclo.html
43
43
  - lib/words.rb
44
- - lib/words_in_numbers.rb_cyclo.html
45
44
  files:
45
+ - CHANGELOG
46
46
  - Manifest
47
47
  - README
48
48
  - Rakefile
49
49
  - examples/display_numbers_in_words.rb
50
- - index_cyclo.html
51
50
  - init.rb
52
51
  - lib/numbers.rb
53
52
  - lib/numbers_in_words.rb
54
- - lib/numbers_in_words.rb_cyclo.html
55
53
  - lib/words.rb
56
- - lib/words_in_numbers.rb_cyclo.html
57
54
  - numbers_in_words.gemspec
58
55
  - spec/numbers_in_words_spec.rb
59
56
  - spec/words_in_numbers_spec.rb
@@ -92,6 +89,6 @@ rubyforge_project: numbers_in_words
92
89
  rubygems_version: 1.3.6
93
90
  signing_key:
94
91
  specification_version: 3
95
- summary: "Example: 123.in_words #=> \"one hundred and twenty three\", \"seventy-five\".in_numbers #=> 75"
92
+ summary: "Example: 123.in_words #=> \"one hundred and twenty three\", \"seventy-five point eight\".in_numbers #=> 75.8"
96
93
  test_files: []
97
94
 
data/index_cyclo.html DELETED
@@ -1,83 +0,0 @@
1
- <html><head><title>Index for cyclomatic complexity</title></head>
2
- <style>
3
- body {
4
- margin: 20px;
5
- padding: 0;
6
- font-size: 12px;
7
- font-family: bitstream vera sans, verdana, arial, sans serif;
8
- background-color: #efefef;
9
- }
10
-
11
- table {
12
- border-collapse: collapse;
13
- /*border-spacing: 0;*/
14
- border: 1px solid #666;
15
- background-color: #fff;
16
- margin-bottom: 20px;
17
- }
18
-
19
- table, th, th+th, td, td+td {
20
- border: 1px solid #ccc;
21
- }
22
-
23
- table th {
24
- font-size: 12px;
25
- color: #fc0;
26
- padding: 4px 0;
27
- background-color: #336;
28
- }
29
-
30
- th, td {
31
- padding: 4px 10px;
32
- }
33
-
34
- td {
35
- font-size: 13px;
36
- }
37
-
38
- .class_name {
39
- font-size: 17px;
40
- margin: 20px 0 0;
41
- }
42
-
43
- .class_complexity {
44
- margin: 0 auto;
45
- }
46
-
47
- .class_complexity>.class_complexity {
48
- margin: 0;
49
- }
50
-
51
- .class_total_complexity, .class_total_lines, .start_token_count, .file_count {
52
- font-size: 13px;
53
- font-weight: bold;
54
- }
55
-
56
- .class_total_complexity, .class_total_lines {
57
- color: #c00;
58
- }
59
-
60
- .start_token_count, .file_count {
61
- color: #333;
62
- }
63
-
64
- .warning {
65
- background-color: yellow;
66
- }
67
-
68
- .error {
69
- background-color: #f00;
70
- }
71
- </style>
72
-
73
- <body>
74
- <h1>Index for cyclomatic complexity</h1>
75
-
76
- <hr/>
77
- <h2 class="class_name">Analyzed Files</h2>
78
- <ul>
79
- <li>
80
- <p class="file_name"><a href="./lib/words_in_numbers.rb_cyclo.html">lib/words_in_numbers.rb</a>
81
- </li>
82
- </ul>
83
- </body></html>
@@ -1,100 +0,0 @@
1
- <html><head><title>Cyclometric Complexity</title></head>
2
- <style>
3
- body {
4
- margin: 20px;
5
- padding: 0;
6
- font-size: 12px;
7
- font-family: bitstream vera sans, verdana, arial, sans serif;
8
- background-color: #efefef;
9
- }
10
-
11
- table {
12
- border-collapse: collapse;
13
- /*border-spacing: 0;*/
14
- border: 1px solid #666;
15
- background-color: #fff;
16
- margin-bottom: 20px;
17
- }
18
-
19
- table, th, th+th, td, td+td {
20
- border: 1px solid #ccc;
21
- }
22
-
23
- table th {
24
- font-size: 12px;
25
- color: #fc0;
26
- padding: 4px 0;
27
- background-color: #336;
28
- }
29
-
30
- th, td {
31
- padding: 4px 10px;
32
- }
33
-
34
- td {
35
- font-size: 13px;
36
- }
37
-
38
- .class_name {
39
- font-size: 17px;
40
- margin: 20px 0 0;
41
- }
42
-
43
- .class_complexity {
44
- margin: 0 auto;
45
- }
46
-
47
- .class_complexity>.class_complexity {
48
- margin: 0;
49
- }
50
-
51
- .class_total_complexity, .class_total_lines, .start_token_count, .file_count {
52
- font-size: 13px;
53
- font-weight: bold;
54
- }
55
-
56
- .class_total_complexity, .class_total_lines {
57
- color: #c00;
58
- }
59
-
60
- .start_token_count, .file_count {
61
- color: #333;
62
- }
63
-
64
- .warning {
65
- background-color: yellow;
66
- }
67
-
68
- .error {
69
- background-color: #f00;
70
- }
71
- </style>
72
- <body>
73
- <div class="class_complexity">
74
- <h2 class="class_name">Module : NumbersInWords</h2>
75
- <div class="class_total_complexity">Total Complexity: 36</div>
76
- <div class="class_total_lines">Total Lines: 197</div>
77
- <table width="100%" border="1">
78
- <tr><th>Method</th><th>Complexity</th><th># Lines</th></tr>
79
- <tr><td>english_group</td><td>5</td><td>13</td></tr>
80
- <tr><td>in_english</td><td class="warning">10</td><td>31</td></tr>
81
- </table>
82
- </div>
83
- <div class="class_complexity">
84
- <h2 class="class_name">Class : Fixnum</h2>
85
- <div class="class_total_complexity">Total Complexity: 0</div>
86
- <div class="class_total_lines">Total Lines: 2</div>
87
- <table width="100%" border="1">
88
- <tr><th>Method</th><th>Complexity</th><th># Lines</th></tr>
89
- </table>
90
- </div>
91
- <div class="class_complexity">
92
- <h2 class="class_name">Class : Bignum</h2>
93
- <div class="class_total_complexity">Total Complexity: 0</div>
94
- <div class="class_total_lines">Total Lines: 2</div>
95
- <table width="100%" border="1">
96
- <tr><th>Method</th><th>Complexity</th><th># Lines</th></tr>
97
- </table>
98
- </div>
99
- </body>
100
- </html>
@@ -1,92 +0,0 @@
1
- <html><head><title>Cyclometric Complexity</title></head>
2
- <style>
3
- body {
4
- margin: 20px;
5
- padding: 0;
6
- font-size: 12px;
7
- font-family: bitstream vera sans, verdana, arial, sans serif;
8
- background-color: #efefef;
9
- }
10
-
11
- table {
12
- border-collapse: collapse;
13
- /*border-spacing: 0;*/
14
- border: 1px solid #666;
15
- background-color: #fff;
16
- margin-bottom: 20px;
17
- }
18
-
19
- table, th, th+th, td, td+td {
20
- border: 1px solid #ccc;
21
- }
22
-
23
- table th {
24
- font-size: 12px;
25
- color: #fc0;
26
- padding: 4px 0;
27
- background-color: #336;
28
- }
29
-
30
- th, td {
31
- padding: 4px 10px;
32
- }
33
-
34
- td {
35
- font-size: 13px;
36
- }
37
-
38
- .class_name {
39
- font-size: 17px;
40
- margin: 20px 0 0;
41
- }
42
-
43
- .class_complexity {
44
- margin: 0 auto;
45
- }
46
-
47
- .class_complexity>.class_complexity {
48
- margin: 0;
49
- }
50
-
51
- .class_total_complexity, .class_total_lines, .start_token_count, .file_count {
52
- font-size: 13px;
53
- font-weight: bold;
54
- }
55
-
56
- .class_total_complexity, .class_total_lines {
57
- color: #c00;
58
- }
59
-
60
- .start_token_count, .file_count {
61
- color: #333;
62
- }
63
-
64
- .warning {
65
- background-color: yellow;
66
- }
67
-
68
- .error {
69
- background-color: #f00;
70
- }
71
- </style>
72
- <body>
73
- <div class="class_complexity">
74
- <h2 class="class_name">Module : WordsInNumbers</h2>
75
- <div class="class_total_complexity">Total Complexity: 21</div>
76
- <div class="class_total_lines">Total Lines: 194</div>
77
- <table width="100%" border="1">
78
- <tr><th>Method</th><th>Complexity</th><th># Lines</th></tr>
79
- <tr><td>in_numbers</td><td>6</td><td>22</td></tr>
80
- <tr><td>parse_numbers</td><td>6</td><td>28</td></tr>
81
- </table>
82
- </div>
83
- <div class="class_complexity">
84
- <h2 class="class_name">Class : String</h2>
85
- <div class="class_total_complexity">Total Complexity: 0</div>
86
- <div class="class_total_lines">Total Lines: 2</div>
87
- <table width="100%" border="1">
88
- <tr><th>Method</th><th>Complexity</th><th># Lines</th></tr>
89
- </table>
90
- </div>
91
- </body>
92
- </html>