sass-prof 0.3.2 → 0.3.3

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: b9aa835308e9fd45498589efe559994bcf37914a
4
- data.tar.gz: 879016e6ccffffb9ad1608cf61418c3f7c86b0d1
3
+ metadata.gz: a5345f6abae1c649f21788c725c6496a1c0efd79
4
+ data.tar.gz: 80fa3bb09cc6b0dad48e0fe46d3bfa98732a2b75
5
5
  SHA512:
6
- metadata.gz: 590560723910cb82c65b43e5df6fdab3b814652c1ecc1a620be19a613550833bd5c101bba65a29ed584d81cec2c4683ff38b975127491edd8d85f9eea99a9257
7
- data.tar.gz: 9a2e89208a84ed73c2c0cca7c5ba5e4974dda483a2c5a9b447b03f6405ea0366c85a00c8173dc38dabe35edad1259d9ee74e32f2b19b945ead8b92ea13a9d4cc
6
+ metadata.gz: 9ed069921056fb469fb3e699a759a0ab1d79ab6ef96672e683997954de4bad7bcdb0c6749c5a1f75e23cc2286bd064ec310ab22b7442e6a87bb3ffbb229b53ba
7
+ data.tar.gz: 2aecdde2cdba349f5594fe12cc769a0e7f3f79be616636694e2d604adf3e74dbe3458eb035e0a35b2668853e18f1eb14da4235f4e132b14412b189afcd424554
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sass
4
4
  module Prof
5
- VERSION = "0.3.2"
5
+ VERSION = "0.3.3"
6
6
  end
7
7
  end
data/lib/sass-prof.rb CHANGED
@@ -57,39 +57,35 @@ module Sass
57
57
 
58
58
  module Formatter
59
59
 
60
+ COLORS = Hash.new("37").merge({
61
+ :black => "30",
62
+ :red => "31",
63
+ :green => "32",
64
+ :yellow => "33",
65
+ :blue => "34",
66
+ :purple => "35",
67
+ :cyan => "36",
68
+ :white => "37",
69
+ })
70
+
60
71
  def colorize(string, color)
61
72
  return string.to_s unless Prof::Config.color
62
73
 
63
- colors = Hash.new("37").merge({
64
- :black => "30",
65
- :red => "31",
66
- :green => "32",
67
- :yellow => "33",
68
- :blue => "34",
69
- :purple => "35",
70
- :cyan => "36",
71
- :white => "37",
72
- })
73
-
74
- "\e[0;#{colors.fetch(color)}m#{string}\e[0m"
74
+ "\e[0;#{COLORS.fetch(color)}m#{string}\e[0m"
75
75
  end
76
76
 
77
77
  def to_table(rows)
78
+ pr = Prof::Config.precision / 3 - 5 # 5 is to account for whitespace
78
79
  t_ms = rows.map { |c|
79
80
  c[1].gsub(/\e\[(\d+)(;\d+)*m/, "").to_f }.reduce :+
80
81
 
81
- if t_ms.nil?
82
- t = Prof::Formatter.colorize "Unknown", :red
83
- elsif t_ms > 1000
84
- t_sec = t_ms / 1000 % 60
85
- t = "%.#{Prof::Config.precision - 1}fs" % t_sec
86
- else
87
- t = "%.#{Prof::Config.precision - 2}fms" % t_ms
88
- end
82
+ t_ss, t_ms = t_ms.divmod 1000
83
+ t_mm, t_ss = t_ss.divmod 60
89
84
 
90
85
  # Add total execution time footer
91
86
  rows << :separator
92
- rows << ["Total", t]
87
+ rows << ["Total",
88
+ "%.#{pr}fm %.#{pr}fs %.#{pr}fms" % [t_mm, t_ss, t_ms]]
93
89
 
94
90
  table = Terminal::Table.new({
95
91
  :headings => ["File", "Execution Time", "Action", "Signature"],
data/screenshot.jpg CHANGED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-prof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ezekg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: compass