kgb 0.9.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.md +3 -3
  2. data/kgb.gemspec +1 -1
  3. data/lib/kgb.rb +3 -2
  4. data/lib/kgb/version.rb +1 -1
  5. metadata +5 -5
data/README.md CHANGED
@@ -47,7 +47,7 @@ pretend_to_be_a_sheep 4
47
47
  think_for_yourself! 1
48
48
  ```
49
49
 
50
- KGB prints to standard error so you can isolate it's output from the rest of the program:
50
+ KGB prints to standard error so you can isolate its output from the rest of the program:
51
51
 
52
52
  ```
53
53
  $ ruby kgb_test.rb >/dev/null
@@ -59,10 +59,10 @@ pretend_to_be_a_sheep 4
59
59
  think_for_yourself! 1
60
60
  ```
61
61
 
62
- KGB only tracks calls to instance methods defined on the object itself, not it's parents. Thus if you want to watch all of the `Socket` methods, you would want to do something like this:
62
+ KGB can spy on multiple classes too!
63
63
 
64
64
  ```ruby
65
- KGB.spy_on(Socket, BasicSocket, IO)
65
+ KGB.spy_on(Socket, File)
66
66
  ```
67
67
 
68
68
  ##Install
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency "rcapture"
21
+ s.add_dependency "rcapture", "~> 1.0.4"
22
22
 
23
23
  # specify any dependencies here; for example:
24
24
  # s.add_development_dependency "rspec"
data/lib/kgb.rb CHANGED
@@ -15,7 +15,6 @@ module KGB
15
15
  @agents.each { |agent| agent.report }
16
16
  end
17
17
 
18
- PADDING = 4
19
18
 
20
19
  class Agent
21
20
  def initialize(klass)
@@ -26,12 +25,14 @@ module KGB
26
25
  include RCapture::Interceptable
27
26
  end
28
27
 
29
- @class.capture :methods => @class.instance_methods(false) do |info|
28
+ @class.capture :methods => @class.instance_methods do |info|
30
29
  @invocations[info.method] ||= 0
31
30
  @invocations[info.method] += 1
32
31
  end
33
32
  end
34
33
 
34
+ PADDING = 4
35
+
35
36
  def report
36
37
  max_length = @invocations.keys.map { |key| key.length }.max
37
38
  max_length = 6 if max_length < "method".length
@@ -1,3 +1,3 @@
1
1
  module KGB
2
- VERSION = "0.9.0"
2
+ VERSION = "1.0.0"
3
3
  end
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: 0.9.0
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,15 +13,15 @@ date: 2011-10-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rcapture
16
- requirement: &70150658171700 !ruby/object:Gem::Requirement
16
+ requirement: &70362339664360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.0.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70150658171700
24
+ version_requirements: *70362339664360
25
25
  description: A little library for spying on your classes and counting method invocations
26
26
  email:
27
27
  - davidbalbert@gmail.com