seed_report 0.3.0 → 0.4.0
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/seed_report/version.rb +1 -1
- data/lib/seed_report.rb +23 -7
- 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: 5e8cbcbf933bc21f987d2cf450eebcd0356b5e5a
|
4
|
+
data.tar.gz: d86414717bcd8be48961627e71869b50929aa4a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad980d6e94236f708258c6bace71533ee8cbf4ec948e278634f85a9856f84db14d90d3dd88593ca77bc29e9f6b0f758ce7337fb34b46c8e3fb79b43393b0aa88
|
7
|
+
data.tar.gz: 795ddc6ebebf564d01e3ad236d3205e47f0300945ac0b5878302fa3506e7f07c32eba98d01980f5d04c04a85feeb2d4ac916f6103903ff1bb3605a3dbb2d1f2e
|
data/lib/seed_report/version.rb
CHANGED
data/lib/seed_report.rb
CHANGED
@@ -4,24 +4,40 @@ module SeedReport
|
|
4
4
|
class << self
|
5
5
|
def for_model(model, &block)
|
6
6
|
initial_count = model.count
|
7
|
-
|
8
|
-
|
7
|
+
output_heading(model)
|
8
|
+
output_initial_count(initial_count)
|
9
9
|
block.call
|
10
|
+
output_increased_count(model.count - initial_count)
|
11
|
+
end
|
12
|
+
|
13
|
+
def output_heading(model)
|
14
|
+
print heading(model)
|
15
|
+
end
|
10
16
|
|
11
|
-
|
12
|
-
|
17
|
+
def output_initial_count(count)
|
18
|
+
print initial_count_display(count)
|
19
|
+
end
|
20
|
+
|
21
|
+
def output_increased_count(count)
|
22
|
+
puts increased_count_display(count)
|
13
23
|
end
|
14
24
|
|
15
25
|
def heading(model)
|
16
|
-
sprintf("
|
26
|
+
sprintf("%-16s", model.name) + " "
|
17
27
|
end
|
18
28
|
|
19
29
|
def initial_count_display(count)
|
20
30
|
"initial count: #{sprintf("%3d", count)}"
|
21
31
|
end
|
22
32
|
|
23
|
-
def
|
24
|
-
|
33
|
+
def increased_count_display(amount)
|
34
|
+
amount_str = sprintf("%3d", amount)
|
35
|
+
amount_colored = amount > 0 ? cyan(amount_str) : amount_str
|
36
|
+
", #{amount_colored} created"
|
37
|
+
end
|
38
|
+
|
39
|
+
def cyan(a_string)
|
40
|
+
"\e[36m#{a_string}\e[0m"
|
25
41
|
end
|
26
42
|
end
|
27
43
|
end
|