pretty_debug 0.4.3 → 0.4.4
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/pretty_debug.rb +12 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1943c286dac1792c1d50ebf266cd89ff8784758f
|
4
|
+
data.tar.gz: 30b6e3a0024d77dee661760de69dc1391d7d5ada
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b10559df7e712fa1cf1ae3017d1b3c4a5e603b1f8248deba8377a9bdc92c7878b5ca90321558d40cf35ede371a452977c6a84ce147440df967fe0d207df6b83
|
7
|
+
data.tar.gz: 539192309569eff7e3691bd60e8b13fc756b7c5cb3088a74c6ce1b6f3bf153950bf511e819e07e77bdd0387eb6652d30187274f5e25d2c8a58985ce2df145d09
|
data/lib/pretty_debug.rb
CHANGED
@@ -123,14 +123,18 @@ module Kernel
|
|
123
123
|
else
|
124
124
|
puts \
|
125
125
|
PrettyDebug.message($!).color(:red),
|
126
|
-
PrettyDebug.backtrace_locations($!)
|
127
|
-
.align.map(&PrettyDebug.instance_variable_get(:@format))
|
126
|
+
PrettyDebug.backtrace_locations($!).to_puts
|
128
127
|
end
|
129
128
|
$stderr.reopen(IO::NULL)
|
130
129
|
$stdout.reopen(IO::NULL)
|
131
130
|
end
|
132
131
|
end
|
133
132
|
|
133
|
+
class PrettyArray < Array
|
134
|
+
def to_puts; align.map(&PrettyDebug.instance_variable_get(:@format)) end
|
135
|
+
def inspect; to_puts.join($/) end
|
136
|
+
end
|
137
|
+
|
134
138
|
class PrettyDebug
|
135
139
|
def self.ignore ≺ @ignore = pr end
|
136
140
|
def self.format ≺ @format = pr end
|
@@ -142,13 +146,15 @@ class PrettyDebug
|
|
142
146
|
end
|
143
147
|
def self.backtrace_locations e
|
144
148
|
e.complement_backtrace_locations
|
145
|
-
a =
|
146
|
-
a.reject do |f, l, m|
|
149
|
+
a = beautify(e.backtrace_locations)
|
150
|
+
a.reject! do |f, l, m|
|
147
151
|
@ignore.call(f, m) or
|
148
152
|
f == __FILE__ or
|
149
153
|
m =~ /\A<.*>\z/ # Such as `<top (required)>`, `<module:Foo>`.
|
150
|
-
end rescue
|
154
|
+
end rescue nil
|
155
|
+
PrettyArray.new(a)
|
151
156
|
end
|
157
|
+
def self.caller_locations; PrettyArray.new(beautify(Kernel.caller_locations)) end
|
152
158
|
Hook = %w[
|
153
159
|
initialize
|
154
160
|
method_missing
|
@@ -167,7 +173,7 @@ class PrettyDebug
|
|
167
173
|
intitialize_clone
|
168
174
|
intitialize_dup
|
169
175
|
]
|
170
|
-
def self.
|
176
|
+
def self.beautify a
|
171
177
|
a
|
172
178
|
.map{|l| [l.absolute_path, l.lineno, l.label]}
|
173
179
|
.transpose.tap do |_, _, ms|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pretty_debug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email: []
|