pocket-console 0.1.0 → 0.1.1

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 (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tagStats.rb +55 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f78cc241f93913fa1ffcacec1c73229ccc675589
4
- data.tar.gz: 184eb1eafd3d474290c71edf54db200dd9a11fdf
3
+ metadata.gz: 9462ed79543a81340ba18c92b26bc53c0e5894f1
4
+ data.tar.gz: 36eec9846fd09c488c3911f369c50a99cb55ae16
5
5
  SHA512:
6
- metadata.gz: dc8059d2beb1216fc6388f8876408338d380de6ea69266e3b9854dfe0942e6181af45b6237dd9e13a2a23a4493362cae01113e3fd743f81b97c22faa3c70ff36
7
- data.tar.gz: 325fc6aebddb725c2d02ce3f91ac732484165c673524a78246930dd2ca8e53666a12aea32eaa439d2033f64dd6cba48ea2c40708d292dc021b9947326e40a1d2
6
+ metadata.gz: 2e493c20755293ff0343a64e75b503c43104380b15f0c78473d172f083c7aabc604fa1df9dad64ffb3a4c1bd65be49bf382b96369e6dcc801498d89460561795
7
+ data.tar.gz: 4ca7a5689196699a57470e8cfd0ddb42820de437c24904b7d894059fa08e3b42415f5277348e1353a951421c407af3dfe2bd0548afb35e3b75816a916731b62a
data/lib/tagStats.rb CHANGED
@@ -7,6 +7,8 @@ class TagStats
7
7
  def print
8
8
  printMostUsed
9
9
  puts ''
10
+ printLessUsed
11
+ puts ''
10
12
  printMostUnread
11
13
  end
12
14
 
@@ -15,24 +17,74 @@ class TagStats
15
17
  puts '================================='
16
18
  puts ' Tag Stats - Most Used '
17
19
  puts '---------------------------------'
20
+ printTopTable
21
+ puts '================================='
22
+ end
23
+
24
+ def printLessUsed
25
+ @tags = @tags.sort_by{|_key, stats| stats['count']}
26
+ puts '================================='
27
+ puts ' Tag Stats - Less Used '
28
+ puts '---------------------------------'
29
+ printUntilTable
30
+ puts '================================='
31
+ end
32
+
33
+ def printTopTable
34
+
18
35
  puts sprintf "%-13s | %6s | %7s", 'tag', 'total', 'unread'
36
+ puts '---------------------------------'
37
+ top_count = 0
38
+
19
39
  @tags.each do |tag, stats|
40
+
20
41
  count = stats['count']
21
- if count == 1
42
+ unread = stats['unread']
43
+ puts sprintf "%-13s | %6d | %7d", tag, count, unread
44
+
45
+ top_count += 1
46
+
47
+ if (top_count == 5)
22
48
  break
23
49
  end
50
+
51
+ end
52
+
53
+ end
54
+
55
+ def printUntilTable
56
+
57
+ puts sprintf "%-13s | %6s | %7s", 'tag', 'total', 'unread'
58
+ puts '---------------------------------'
59
+
60
+ changeCount = 0
61
+ prevCount = 0
62
+
63
+ @tags.each do |tag, stats|
64
+
65
+ count = stats['count']
66
+ if (count > prevCount)
67
+ changeCount += 1
68
+ if (changeCount == 4)
69
+ break
70
+ end
71
+ end
72
+ prevCount = stats['count']
73
+
24
74
  unread = stats['unread']
25
75
  puts sprintf "%-13s | %6d | %7d", tag, count, unread
76
+
26
77
  end
27
- puts '================================='
78
+
28
79
  end
29
80
 
30
81
  def printMostUnread
31
82
  @tags = @tags.sort_by{|_key, stats| stats['unread']}.reverse!
32
83
  puts '================================='
33
84
  puts ' Tag Stats - Most Unread '
34
- puts '---------------------------------'
85
+ puts '---------------------------------'
35
86
  puts sprintf "%-13s | %7s | %6s", 'tag', 'unread', 'total'
87
+ puts '---------------------------------'
36
88
  @tags.each do |tag, stats|
37
89
  unread = stats['unread']
38
90
  if unread == 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pocket-console
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Cedillo