pretty_debug 0.5.1 → 0.6.0
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 +15 -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: c6fef9338276578fa99842e75229d0603199b534
|
4
|
+
data.tar.gz: 16419c3856e68720c6f6174113ce23e9e81801fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6103195bfab4700a63c8ee4d933ad3fe2c73f84cd31830ce337daa6cfb6a11dd65bfd19fde2cd77839305cc8362c6dc3bf36668fe026a0fac97c4e90b2a4ced1
|
7
|
+
data.tar.gz: ace06c28be584d84879e2623b03a4568c7a0ea9e7b749da977fd89ac4cc65845dc963a90444cda6aac35b56fa5b215ada0db8d36c4b387696513568a2a7ad417
|
data/lib/pretty_debug.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!ruby
|
2
|
-
require "tmpdir"
|
3
|
-
require "compact_time"
|
4
|
-
require "utility"
|
2
|
+
require "tmpdir"
|
3
|
+
require "compact_time"
|
4
|
+
require "utility"
|
5
5
|
|
6
6
|
#############################################
|
7
7
|
# File
|
@@ -34,7 +34,7 @@ end
|
|
34
34
|
#############################################
|
35
35
|
|
36
36
|
class String
|
37
|
-
@@indent = " "
|
37
|
+
@@indent = " "
|
38
38
|
def indent n = 1; gsub(/^/, @@indent * n) end
|
39
39
|
def unindent; gsub(/^#{match(/^\s+/)}/, "".freeze).chomp end
|
40
40
|
def unchomp; sub(/#$/?\z/, $/) end
|
@@ -63,6 +63,15 @@ end
|
|
63
63
|
#
|
64
64
|
#############################################
|
65
65
|
|
66
|
+
module Kernel
|
67
|
+
def class_check v, klass, &pr
|
68
|
+
unless v.kind_of?(klass)
|
69
|
+
ArgumentError.raise(
|
70
|
+
"#{pr.call + " " if pr}should be #{klass.expand} but is #{v.expand}")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
66
75
|
class Exception
|
67
76
|
attr_accessor :backtrace_locations
|
68
77
|
def complement_backtrace_locations
|
@@ -216,14 +225,14 @@ class Array
|
|
216
225
|
end.transpose
|
217
226
|
end
|
218
227
|
def common_prefix
|
219
|
-
|
228
|
+
each{|e| class_check(e, String){"All elements must be a String".freeze}}
|
220
229
|
first, *others = self
|
221
230
|
i = 0
|
222
231
|
loop{break unless first[i] and others.all?{|s| first[i] == s[i]}; i += 1}
|
223
232
|
first[0, i]
|
224
233
|
end
|
225
234
|
def common_affix
|
226
|
-
|
235
|
+
each{|e| class_check(e, String){"All elements must be a String".freeze}}
|
227
236
|
first, *others = self
|
228
237
|
i = - 1
|
229
238
|
loop{break unless first[i] and others.all?{|s| first[i] == s[i]}; i -= 1}
|
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
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email: []
|