wc 0.50.0 → 0.90.0

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.
Files changed (6) hide show
  1. data/README.rdoc +3 -0
  2. data/VERSION +1 -1
  3. data/bin/wc +1 -1
  4. data/lib/wc.rb +16 -0
  5. data/wc.gemspec +1 -1
  6. 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.50.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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wc}
8
- s.version = "0.50.0"
8
+ s.version = "0.90.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paolo Perego"]
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: 215
4
+ hash: 375
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 50
8
+ - 90
9
9
  - 0
10
- version: 0.50.0
10
+ version: 0.90.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paolo Perego