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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/pretty_debug.rb +8 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45103fd42c9f940c143c0890773ebd4c8505b42b
4
- data.tar.gz: d7b93f6ea9c79af40c4fff91ad9441f817c4e6c5
3
+ metadata.gz: 5fb272c41cfb79879fc47872950a08010fb4d5ff
4
+ data.tar.gz: c55eddf7946300fc4ad6f164524d4bd612927117
5
5
  SHA512:
6
- metadata.gz: 6d9afe543140d88fedbd5f839f35707fedcedc4a2da68299659d2b9de020e8c9d46a0e234367c8d24b49a5590e378eccf95b526aac8f86c6a13f5381e23c43e0
7
- data.tar.gz: 1aa24cab83f8b8dbed2ec165cc307334c9419abef0e278491f31a0519cdf18056dc7df64e62cf08a2a47e8b096e83b7136cacaa057f50bbd4a58cc3a2bec39a2
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
- unless v.kind_of?(klass)
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 but is #{v.expand}")
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.5
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-02 00:00:00.000000000 Z
11
+ date: 2014-03-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ''
14
14
  email: []