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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49ee92d0a9a6b3dac23932f8362a7c054544cd65
4
- data.tar.gz: b601b5ce5c871da88406c7ffd5e9d476ace268f0
3
+ metadata.gz: 13a49ae4a8d3bf31bf22804e2cc8934692bf64b2
4
+ data.tar.gz: 831136e25f53dbcde7b96481c0dd7321d20c1f1a
5
5
  SHA512:
6
- metadata.gz: 6a65e7683d8a41ba5ba80d73bb37195e37b3307af2593804fe7edb853d9220499658d70b0a7040206ff4da8358c882b37433c914354d9b1382893a69cb4055b6
7
- data.tar.gz: 688b0d615078529c8dad11b2e5cbe2b8d5933eb4f69bfb099f4e3ffa9fe103ea40d39e080862683e787e71a6372194737075a78c3c0594c41722ef0595d3d890
6
+ metadata.gz: f2307ba77d0685bd8910f6fcb86cc2490bfe3fa04b091032b1a7661a6817104f821ae1ca21b80843c48e93b40c759861ebe9c0cf44b07a4ded35cc5ce77c8840
7
+ data.tar.gz: 7ee50c65c8010d30dfeb882e60cf396032c716623b4812072d9696586504b4e856491b87717d5be56e7f3e3967c79e9011882dba4117344e30865217f0aaf71b
@@ -36,4 +36,5 @@ k.keycount_reader("USA")
36
36
 
37
37
  # Display all values
38
38
  pp k.keycount_compile
39
+ k.keycount_stats
39
40
 
@@ -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
- pp e
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
- keycounts
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.7
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-07-24 00:00:00.000000000 Z
11
+ date: 2015-08-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Count up value totals
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 value counter
44
+ summary: Key Counter
45
45
  test_files: []