pretty_debug 0.7.5 → 0.7.6
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 +8 -3
- 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: 5fb272c41cfb79879fc47872950a08010fb4d5ff
|
4
|
+
data.tar.gz: c55eddf7946300fc4ad6f164524d4bd612927117
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28e978bfde122dd795749c4d1ef49477e6626cfe186317447957dd9fd41708949e472c22a4780e4d76e6e8f929e8c880effd1a5d5acd791ebfa90aa5063d298d
|
7
|
+
data.tar.gz: 7ad0a9de7afc645a1bc5eefaae184080925c266a5a84d6ed2d7e2601c1a9491e73d91443438c846b32414fa44d4223bebc57aaf3326b385aa00417ae20b1dabd
|
data/lib/pretty_debug.rb
CHANGED
@@ -40,10 +40,13 @@ class Object
|
|
40
40
|
end
|
41
41
|
|
42
42
|
module Kernel
|
43
|
-
def class_check v, klass, &pr
|
44
|
-
|
43
|
+
def class_check v, *klass, &pr
|
44
|
+
case v
|
45
|
+
when *klass
|
46
|
+
else
|
45
47
|
ArgumentError.raise(
|
46
|
-
"#{pr.call + " " if pr}should be #{klass.expand} instance
|
48
|
+
"#{pr.call + " " if pr}should be #{klass.map(&:expand).join(", ")} instance"\
|
49
|
+
"but is #{v.expand}")
|
47
50
|
end
|
48
51
|
end
|
49
52
|
end
|
@@ -252,6 +255,8 @@ class Array
|
|
252
255
|
i = 0
|
253
256
|
loop{break unless first[i] and others.all?{|s| first[i] == s[i]}; i += 1}
|
254
257
|
first[0, i]
|
258
|
+
# This is more elegant, but cannot be generalized to `common_affix`.
|
259
|
+
## first[0, (0...first.length).find{|i| first[i].! or others.any?{|s| first[i] != s[i]}}.to_i]
|
255
260
|
end
|
256
261
|
def common_affix
|
257
262
|
each{|e| class_check(e, String){"All elements must be a String".freeze}}
|
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.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email: []
|