keycounter 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/countries.rb +1 -0
- data/lib/keycounter.rb +8 -11
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13a49ae4a8d3bf31bf22804e2cc8934692bf64b2
|
4
|
+
data.tar.gz: 831136e25f53dbcde7b96481c0dd7321d20c1f1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2307ba77d0685bd8910f6fcb86cc2490bfe3fa04b091032b1a7661a6817104f821ae1ca21b80843c48e93b40c759861ebe9c0cf44b07a4ded35cc5ce77c8840
|
7
|
+
data.tar.gz: 7ee50c65c8010d30dfeb882e60cf396032c716623b4812072d9696586504b4e856491b87717d5be56e7f3e3967c79e9011882dba4117344e30865217f0aaf71b
|
data/examples/countries.rb
CHANGED
data/lib/keycounter.rb
CHANGED
@@ -7,15 +7,10 @@
|
|
7
7
|
# A Simple counter using just instance variables
|
8
8
|
#
|
9
9
|
########################################################################
|
10
|
+
require 'pp'
|
10
11
|
|
11
12
|
class Keycounter
|
12
13
|
|
13
|
-
#attr_writer :verbose
|
14
|
-
|
15
|
-
#def initialize
|
16
|
-
#@verbose = true
|
17
|
-
#end
|
18
|
-
|
19
14
|
# Create / Add to instance variable
|
20
15
|
def keycount(key)
|
21
16
|
key.gsub!(" ", "_") # no spaces or case
|
@@ -37,11 +32,8 @@ class Keycounter
|
|
37
32
|
begin
|
38
33
|
return [key, instance_variable_get("@#{key}")]
|
39
34
|
rescue => e
|
40
|
-
|
35
|
+
pp e
|
41
36
|
end
|
42
|
-
# if @verbose == true
|
43
|
-
# puts "Key: #{key} Value: "+instance_variable_get("@#{key}").to_s
|
44
|
-
# end
|
45
37
|
end
|
46
38
|
|
47
39
|
# Read a single key
|
@@ -61,7 +53,12 @@ class Keycounter
|
|
61
53
|
keycounts << ["#{t}", instance_variable_get("#{n}")]
|
62
54
|
}
|
63
55
|
return keycounts
|
64
|
-
|
56
|
+
end
|
57
|
+
|
58
|
+
def keycount_stats(title="Stats:")
|
59
|
+
puts "#{title}"
|
60
|
+
stats = keycount_compile
|
61
|
+
pp stats.sort_by { |h| h[1] }
|
65
62
|
end
|
66
63
|
|
67
64
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keycounter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Hood
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
13
|
+
description: Counter for reoccuring data using instance variables
|
14
14
|
email: brianh6854@googlemail.com
|
15
15
|
executables: []
|
16
16
|
extensions: []
|
@@ -41,5 +41,5 @@ rubyforge_project:
|
|
41
41
|
rubygems_version: 2.2.2
|
42
42
|
signing_key:
|
43
43
|
specification_version: 4
|
44
|
-
summary: Key
|
44
|
+
summary: Key Counter
|
45
45
|
test_files: []
|