toolbus 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/utils.rb +4 -0
  3. data/lib/views.rb +5 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ccb5074de945b67aed0432df47ef97af1bc617c2
4
- data.tar.gz: 7382c5bf096cd7c95877dc4b8de2057d14970895
3
+ metadata.gz: 06edf1245ee5e21a3eac3bc7ebcf8a906d794053
4
+ data.tar.gz: 36da9d2ac09607b41bb8ef45e6080612321b2ab7
5
5
  SHA512:
6
- metadata.gz: 9faa12082810aec85ed8ea661460670f7b0014590b7d42cb030625132088fb7a81578c31f1a498d8eab8580fcd469628fd350d529e0718a3302b69725b902464
7
- data.tar.gz: 5c812313f3ff79779df19dd9650c5ad33112a250e7f1a36a3823be600445b7cdfcd8b539e7a209e0e3c197bf791888b84a9a226d95fb7e8915a69492f4e34de6
6
+ metadata.gz: 9f9f79ad3052b07d3e07405b8255da330fa1704a04cf5ad5c3d66055f9dab91cacaa83266934c15dc439be3bc640402fb2f26f0075cddd5c3b0d3bd446fa37a0
7
+ data.tar.gz: 4e97e3acd1446a404dfd5b8c97b3165a5763bc65188159b64d015178fb804950910c73bfd7c9dad04db58ca80d2fd53fb2f5b04d8382990a32690a43278b353b
data/lib/utils.rb CHANGED
@@ -48,4 +48,8 @@ class String
48
48
 
49
49
  "#{self[0, stop]}#{omission}"
50
50
  end
51
+
52
+ def at_width(width)
53
+ truncate(width).ljust(width)
54
+ end
51
55
  end
data/lib/views.rb CHANGED
@@ -50,12 +50,14 @@ class TableView
50
50
  @map = map
51
51
  end
52
52
 
53
+ CHECKMARK_CHARS_OFFSET = 2
54
+ COUNT_CHARS_OFFSET = 5
53
55
  def to_s
54
56
  @map.map do |(key, count)|
55
57
  color = count > 0 ? GREEN : RED
56
58
  done = count > 0 ? "✓" : " "
57
- description = key.truncate(SCREEN_WIDTH - 4).ljust(SCREEN_WIDTH - 3)
58
- [color, done, ' ', description, count.to_s, RESET].join
59
+ description = key.at_width(SCREEN_WIDTH - COUNT_CHARS_OFFSET - CHECKMARK_CHARS_OFFSET)
60
+ [color, done, ' ', description, count.to_s.rjust(COUNT_CHARS_OFFSET), RESET].join
59
61
  end
60
62
  end
61
63
  end
@@ -72,6 +74,6 @@ class StatusBoxView
72
74
  puts
73
75
  num_lines = @statuses.length
74
76
  lines = @statuses.last(8).fill(num_lines, 8 - num_lines) { '' }
75
- lines.map { |line| line.truncate(SCREEN_WIDTH).ljust(SCREEN_WIDTH) }.join("\n")
77
+ lines.map { |line| line.at_width(SCREEN_WIDTH) }.join("\n")
76
78
  end
77
79
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toolbus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Benn