pretty_debug 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pretty_debug.rb +12 -13
- 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: daebf11b22f4b74d274bcd11c1a69b25cf447e42
|
4
|
+
data.tar.gz: 7bb44aa54050d8c79daf3e5917ccc9f80df41365
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8812a72e34d7cec4192bc589a162bd44c9c36170374ae1acab6cd93ad0b63c21c868e34011fc12ffa1bb90fb5bcdb799456812e58832617171c23841c44f8de
|
7
|
+
data.tar.gz: d2978229f21e5c3ad352d087b482eac84e5ed87fc526ba9df83efe3b2eb85484bba0540faed9e0a9dbdf370f58a47a9d773992094daa6a7b8b06b2b90d76f0d3
|
data/lib/pretty_debug.rb
CHANGED
@@ -22,31 +22,29 @@ end
|
|
22
22
|
#############################################
|
23
23
|
|
24
24
|
class Object
|
25
|
-
def intercept
|
25
|
+
def intercept; self ensure
|
26
26
|
l = caller_location
|
27
|
-
|
27
|
+
puts \
|
28
28
|
"[Debug] #{"#{l.realpath}:#{l.lineno}"}".bf.color(:yellow),
|
29
29
|
inspect.verbatim
|
30
|
-
end
|
31
30
|
end
|
32
|
-
def which m
|
31
|
+
def which m; self ensure
|
33
32
|
l = caller_location
|
34
33
|
m = :method_missing unless self.class.method_defined?(m)
|
35
34
|
mt = method(m)
|
36
|
-
|
35
|
+
puts \
|
37
36
|
"[Debug] #{"#{l.realpath}:#{l.lineno}"}".bf.color(:yellow),
|
38
37
|
"#{self.class}(#{mt.owner})##{m}@#{mt.source_location.to_a.join(":".freeze)}"
|
39
|
-
end
|
40
38
|
end
|
41
39
|
end
|
42
40
|
|
43
41
|
module Kernel
|
44
|
-
def class_check *klass, v
|
42
|
+
def class_check *klass, v
|
45
43
|
case v
|
46
44
|
when *klass
|
47
45
|
else
|
48
46
|
ArgumentError.raise(
|
49
|
-
"#{
|
47
|
+
"#{yield + " ".freeze if block_given?}should be #{klass.map(&:expand).join(", ".freeze)} instance "\
|
50
48
|
"but is #{v.expand}")
|
51
49
|
end
|
52
50
|
end
|
@@ -102,8 +100,9 @@ module Kernel
|
|
102
100
|
# Suppress warning message ("already initialized constants".freeze, etc.).
|
103
101
|
def suppress_warning
|
104
102
|
original_verbose, $VERBOSE = $VERBOSE, nil
|
105
|
-
yield
|
106
|
-
|
103
|
+
result = yield
|
104
|
+
$VERBOSE = original_verbose
|
105
|
+
result
|
107
106
|
end
|
108
107
|
at_exit do
|
109
108
|
# Terminated iterations (such as in `Sass::SyntaxError.backtrace`) overwrites `$!`.
|
@@ -196,7 +195,7 @@ class PrettyArray < Array
|
|
196
195
|
super(a)
|
197
196
|
reject!{
|
198
197
|
|f, l, m|
|
199
|
-
|
198
|
+
f == __FILE__ or
|
200
199
|
m =~ /\A<.*>\z/ # Such as `<top (required)>`, `<module:Foo>`.
|
201
200
|
}
|
202
201
|
reject, select =
|
@@ -308,7 +307,7 @@ class Array
|
|
308
307
|
each{|e| class_check(String, e){"All elements must be a String".freeze}}
|
309
308
|
first, *others = self
|
310
309
|
i = 0
|
311
|
-
|
310
|
+
i += 1 while first[i] and others.all?{|s| first[i] == s[i]}
|
312
311
|
first[0, i]
|
313
312
|
# This is more elegant, but cannot be generalized to `common_affix`.
|
314
313
|
## first[0, (0...first.length).find{|i| first[i].! or others.any?{|s| first[i] != s[i]}}.to_i]
|
@@ -317,7 +316,7 @@ class Array
|
|
317
316
|
each{|e| class_check(String, e){"All elements must be a String".freeze}}
|
318
317
|
first, *others = self
|
319
318
|
i = - 1
|
320
|
-
|
319
|
+
i -= 1 while first[i] and others.all?{|s| first[i] == s[i]}
|
321
320
|
first[i + 1, -(i + 1)]
|
322
321
|
end
|
323
322
|
end
|
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.9.
|
4
|
+
version: 0.9.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email: []
|