betterp 0.1.8 → 0.1.9
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/Gemfile.lock +1 -1
- data/lib/betterp/output.rb +9 -6
- data/lib/betterp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2e074e62cc8e756a7a2cb29e903cccaf7b5bae4126c91904465e3d7c7de51eb2
|
|
4
|
+
data.tar.gz: 134e6c230d81e457ccba7d65a4aa97b970cafdc9995a02669c1ad908c49023d6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5d5950f55103b70368c5a14de56e28c3277c30ca103101a2565de8c7bdf5752006b77f3731a4ff06d1b804e8b89687bf3af54dc2eba040c215672548e09c825e
|
|
7
|
+
data.tar.gz: d78d6cea46453f93b083530e22186d6adc8fd7801b3964e4f11b9c4af987b4f7cd798d6f4287823ce0d0027f9aefaa2aeb30402df72f15f80a8e2e983bfd7d70
|
data/Gemfile.lock
CHANGED
data/lib/betterp/output.rb
CHANGED
|
@@ -14,10 +14,15 @@ module Betterp
|
|
|
14
14
|
@pretty = options.fetch(:pretty, false)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def formatted(args)
|
|
17
|
+
def formatted(args) # rubocop:disable Metrics/MethodLength
|
|
18
18
|
(@pretty ? args : args.map(&:inspect)).map do |arg|
|
|
19
19
|
output = [
|
|
20
|
-
header,
|
|
20
|
+
header,
|
|
21
|
+
colorized_prefix,
|
|
22
|
+
colorized_duration,
|
|
23
|
+
highlighted(caller_code),
|
|
24
|
+
Paintbrush.paintbrush { cyan_b '=>' },
|
|
25
|
+
highlighted(pretty(arg))
|
|
21
26
|
].compact.join(' ').chomp
|
|
22
27
|
"#{output}\n"
|
|
23
28
|
end
|
|
@@ -28,7 +33,7 @@ module Betterp
|
|
|
28
33
|
def highlighted(output)
|
|
29
34
|
formatter = Rouge::Formatters::Terminal256.new
|
|
30
35
|
lexer = Rouge::Lexers::Ruby.new
|
|
31
|
-
formatter.format(lexer.lex(output))
|
|
36
|
+
formatter.format(lexer.lex(output.nil? ? '' : output))
|
|
32
37
|
end
|
|
33
38
|
|
|
34
39
|
def colorized_duration
|
|
@@ -59,9 +64,7 @@ module Betterp
|
|
|
59
64
|
path, line, *_rest = @raw.split(':')
|
|
60
65
|
return nil unless Pathname.new(path).readable? && line.to_i.positive?
|
|
61
66
|
|
|
62
|
-
|
|
63
|
-
white "{ #{blue find_caller(line.to_i, path).to_s.strip} }"
|
|
64
|
-
end
|
|
67
|
+
find_caller(line.to_i, path).to_s.strip
|
|
65
68
|
end
|
|
66
69
|
|
|
67
70
|
def find_caller(line_number, path)
|
data/lib/betterp/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: betterp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bob Farrell
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-11-
|
|
11
|
+
date: 2023-11-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: paintbrush
|