wc 0.50.0 → 0.90.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -0
- data/VERSION +1 -1
- data/bin/wc +1 -1
- data/lib/wc.rb +16 -0
- data/wc.gemspec +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -15,6 +15,9 @@ wc gem is a very simple word counter. It takes a file in input and prints the wo
|
|
15
15
|
$bin/wc -w x filename
|
16
16
|
It prints out only the first x words that appear with highest rate in filename
|
17
17
|
|
18
|
+
$bin/wc --cloud filename
|
19
|
+
It prints out the result using definition list HTML tag. This can be used to generate tag clouds
|
20
|
+
|
18
21
|
== Note on Patches/Pull Requests
|
19
22
|
|
20
23
|
* Fork the project.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.90.0
|
data/bin/wc
CHANGED
@@ -10,7 +10,7 @@ opts = GetoptLong.new(
|
|
10
10
|
[ '--version', '-v', GetoptLong::NO_ARGUMENT ],
|
11
11
|
[ '--json', '-j', GetoptLong::NO_ARGUMENT ],
|
12
12
|
[ '--xml', '-x', GetoptLong::NO_ARGUMENT ],
|
13
|
-
[ '--cloud', '-c', GetoptLong::NO_ARGUMENT]
|
13
|
+
[ '--cloud', '-c', GetoptLong::NO_ARGUMENT]
|
14
14
|
)
|
15
15
|
|
16
16
|
output = 'text'
|
data/lib/wc.rb
CHANGED
@@ -28,6 +28,20 @@ class Wc
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
def to_cloud
|
32
|
+
if @words == -1
|
33
|
+
cloud_items = @sorted
|
34
|
+
else
|
35
|
+
cloud_item = @sorted[0..@words-1]
|
36
|
+
end
|
37
|
+
ret = "<dl>"
|
38
|
+
cloud_item.each { |elem|
|
39
|
+
ret+="<dt>" + elem[0] +"</dt>"
|
40
|
+
}
|
41
|
+
ret += "</dl>"
|
42
|
+
ret
|
43
|
+
end
|
44
|
+
|
31
45
|
private
|
32
46
|
|
33
47
|
def read()
|
@@ -41,4 +55,6 @@ class Wc
|
|
41
55
|
occurrences
|
42
56
|
end
|
43
57
|
|
58
|
+
|
59
|
+
|
44
60
|
end
|
data/wc.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 375
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 90
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.90.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Paolo Perego
|