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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 019532d49673814af6985ed6064dc8e37de51333
4
- data.tar.gz: f19dfc85044ede21163f536b9e5e745142958b75
3
+ metadata.gz: 5e8cbcbf933bc21f987d2cf450eebcd0356b5e5a
4
+ data.tar.gz: d86414717bcd8be48961627e71869b50929aa4a8
5
5
  SHA512:
6
- metadata.gz: a8d3576986076e0d6818581748f34f94e606312789b695acc80312e72cc358ff62aee3e17f1d6fba3e5f53bd240af775dbbecf9827f3b71fb72554137d0facc2
7
- data.tar.gz: 0f8fcda82f36e1b28cd0f48b5e6cd5d6a1921946ccc8f7f29e6a9453bb5b7c01e63ae1d563a006a41c2a3e9201fe917cb62a53bdebf98b56c31fe1ef8fd35db2
6
+ metadata.gz: ad980d6e94236f708258c6bace71533ee8cbf4ec948e278634f85a9856f84db14d90d3dd88593ca77bc29e9f6b0f758ce7337fb34b46c8e3fb79b43393b0aa88
7
+ data.tar.gz: 795ddc6ebebf564d01e3ad236d3205e47f0300945ac0b5878302fa3506e7f07c32eba98d01980f5d04c04a85feeb2d4ac916f6103903ff1bb3605a3dbb2d1f2e
@@ -1,3 +1,3 @@
1
1
  module SeedReport
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
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
- print "#{heading(model)} #{initial_count_display(initial_count)}"
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
- increase = model.count - initial_count
12
- puts final_count_display(increase)
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(" %-19s", model.name)
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 final_count_display(amount)
24
- ", #{sprintf("%3s", amount)} created"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter