wc 0.40.0 → 0.50.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 (5) hide show
  1. data/VERSION +1 -1
  2. data/bin/wc +8 -1
  3. data/lib/wc.rb +5 -1
  4. data/wc.gemspec +2 -2
  5. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.40.0
1
+ 0.50.0
data/bin/wc CHANGED
@@ -9,12 +9,14 @@ opts = GetoptLong.new(
9
9
  [ '--words', '-w', GetoptLong::REQUIRED_ARGUMENT],
10
10
  [ '--version', '-v', GetoptLong::NO_ARGUMENT ],
11
11
  [ '--json', '-j', GetoptLong::NO_ARGUMENT ],
12
- [ '--xml', '-x', GetoptLong::NO_ARGUMENT ]
12
+ [ '--xml', '-x', GetoptLong::NO_ARGUMENT ],
13
+ [ '--cloud', '-c', GetoptLong::NO_ARGUMENT],
13
14
  )
14
15
 
15
16
  output = 'text'
16
17
  words = -1
17
18
 
19
+
18
20
  begin
19
21
  opts.each do |opt, arg|
20
22
  case opt
@@ -29,6 +31,8 @@ opts.each do |opt, arg|
29
31
  output = 'json'
30
32
  when '--words'
31
33
  words = arg.to_i
34
+ when '--cloud'
35
+ output = 'cloud'
32
36
  end
33
37
  end
34
38
  rescue
@@ -52,5 +56,8 @@ end
52
56
  if output == 'xml'
53
57
  puts 'xml support is coming soon...'
54
58
  end
59
+ if output == 'cloud'
60
+ p w.to_cloud
61
+ end
55
62
 
56
63
  exit 0
data/lib/wc.rb CHANGED
@@ -21,7 +21,11 @@ class Wc
21
21
  end
22
22
 
23
23
  def to_json
24
- @sorted.to_json
24
+ if @words == -1
25
+ return @sorted.to_json
26
+ else
27
+ return @sorted[0..@words-1].to_json
28
+ end
25
29
  end
26
30
 
27
31
  private
data/wc.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wc}
8
- s.version = "0.40.0"
8
+ s.version = "0.50.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"]
12
- s.date = %q{2010-06-30}
12
+ s.date = %q{2010-07-01}
13
13
  s.default_executable = %q{wc}
14
14
  s.description = %q{your ruby word counter experience}
15
15
  s.email = %q{thesp0nge@gmail.com}
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: 191
4
+ hash: 215
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 40
8
+ - 50
9
9
  - 0
10
- version: 0.40.0
10
+ version: 0.50.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paolo Perego
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-06-30 00:00:00 +02:00
18
+ date: 2010-07-01 00:00:00 +02:00
19
19
  default_executable: wc
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency