kgb 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +12 -0
- data/lib/kgb.rb +8 -6
- data/lib/kgb/version.rb +1 -1
- metadata +5 -4
data/ChangeLog.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
v1.0.1 - Oct 21 2011
|
2
|
+
|
3
|
+
* Agent#report no longer crashes when no invocations have been recorded.
|
4
|
+
|
5
|
+
v1.0.0 - Oct 20 2011
|
6
|
+
|
7
|
+
* Watch for method calls in superclasses as well as the class we're spying
|
8
|
+
on.
|
9
|
+
|
10
|
+
v0.9.0 - Oct 20 2011
|
11
|
+
|
12
|
+
* Initial release of kgb
|
data/lib/kgb.rb
CHANGED
@@ -34,16 +34,18 @@ module KGB
|
|
34
34
|
PADDING = 4
|
35
35
|
|
36
36
|
def report
|
37
|
-
max_length = @invocations.keys.map { |key| key.length }.max
|
38
|
-
max_length = 6 if max_length < "method".length
|
39
|
-
|
40
37
|
say
|
41
38
|
say "#{@class}:"
|
42
39
|
say
|
43
40
|
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
if @invocations.size > 0
|
42
|
+
max_length = @invocations.keys.map { |key| key.length }.max
|
43
|
+
max_length = 6 if max_length < "method".length
|
44
|
+
|
45
|
+
say "method" + " " * (max_length - 6 + PADDING) + "invocations"
|
46
|
+
@invocations.sort { |a, b| b[1] <=> a[1] }.each do |method, times|
|
47
|
+
say method.to_s + " " * (max_length - method.length + PADDING) + times.to_s
|
48
|
+
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
end
|
data/lib/kgb/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kgb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-21 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rcapture
|
16
|
-
requirement: &
|
16
|
+
requirement: &70124502675080 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 1.0.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70124502675080
|
25
25
|
description: A little library for spying on your classes and counting method invocations
|
26
26
|
email:
|
27
27
|
- davidbalbert@gmail.com
|
@@ -30,6 +30,7 @@ extensions: []
|
|
30
30
|
extra_rdoc_files: []
|
31
31
|
files:
|
32
32
|
- .gitignore
|
33
|
+
- ChangeLog.md
|
33
34
|
- Gemfile
|
34
35
|
- LICENSE
|
35
36
|
- README.md
|