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.
- checksums.yaml +4 -4
- data/lib/tagStats.rb +55 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9462ed79543a81340ba18c92b26bc53c0e5894f1
|
4
|
+
data.tar.gz: 36eec9846fd09c488c3911f369c50a99cb55ae16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
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
|