wc 0.95.0 → 0.95.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/wc.rb +17 -16
- data/wc.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.95.
|
1
|
+
0.95.1
|
data/lib/wc.rb
CHANGED
@@ -1,32 +1,27 @@
|
|
1
1
|
class Wc
|
2
|
-
attr_reader :filename, :occurrences, :words, :no_autorun
|
2
|
+
attr_reader :filename, :occurrences, :words, :no_autorun, :css, :css_mode
|
3
3
|
attr_accessor :hide_list
|
4
4
|
|
5
|
-
#
|
6
|
-
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
# @filename = STDIN
|
12
|
-
# @occurrences = feed
|
13
|
-
# end
|
14
|
-
|
15
|
-
# @hide_list = hide_list
|
16
|
-
# @sorted = Array(occurrences).sort { |one, two| -(one[1] <=> two[1]) }
|
17
|
-
# @words = words
|
18
|
-
#end
|
5
|
+
# Creates a new Wc object
|
6
|
+
#
|
7
|
+
# The filename is no mandatory, but if provided it will be used to feed thw
|
8
|
+
# word counter gem, otherwise standard input is used.
|
9
|
+
# Options is an array customizing the gem's behavior further.
|
10
|
+
#
|
19
11
|
|
20
12
|
def initialize(filename=nil, options={})
|
21
13
|
@hide_list = options["hide_list"]
|
22
14
|
@words = options["words"]
|
23
15
|
@no_autorun = options["no_autorun"]
|
24
16
|
|
17
|
+
@css_mode = options["css_mode"]
|
18
|
+
|
25
19
|
if ! @hide_list
|
26
20
|
@hide_list = []
|
27
21
|
end
|
28
|
-
|
22
|
+
|
29
23
|
if ! @no_autorun
|
24
|
+
warn "[DEPRECATION]: 'no_autorun' option will be deprecated in wc 1.0.0 and the default behavior will be no_autorun=TRUE"
|
30
25
|
if filename
|
31
26
|
@filename = filename
|
32
27
|
@occurrences = _read
|
@@ -102,6 +97,12 @@ class Wc
|
|
102
97
|
|
103
98
|
def get()
|
104
99
|
@sorted = Array(occurrences).sort { |one, two| -(one[1] <=> two[1]) }
|
100
|
+
if @words == -1
|
101
|
+
c = @sorted
|
102
|
+
else
|
103
|
+
c = @sorted[0..@words-1]
|
104
|
+
end
|
105
|
+
@sorted = c
|
105
106
|
end
|
106
107
|
|
107
108
|
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.95.
|
8
|
+
s.version = "0.95.1"
|
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-07-
|
12
|
+
s.date = %q{2010-07-14}
|
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:
|
4
|
+
hash: 353
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 95
|
9
|
-
-
|
10
|
-
version: 0.95.
|
9
|
+
- 1
|
10
|
+
version: 0.95.1
|
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-07-
|
18
|
+
date: 2010-07-14 00:00:00 +02:00
|
19
19
|
default_executable: wc
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|