puppy 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Rakefile +12 -0
- data/lib/puppy.rb +12 -2
- data/puppy.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzFmYTNiZDJkODQwODBiMTMyNGEzODMzODdmYjUxYWNlMDUxMWQyYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmJiNDRiOGVhNjlmMThiNmQzZWNiMjUxNmM0ZGFhZTI4MmZkNGE2OQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDRlNjNkOTdiMzRkYzgxNzMxYjgyNDc0MGEwZjM3YzNiYTE1N2QwYjc1MjU4
|
10
|
+
NjYwMjc1YjE1YzlkYmZiM2RlY2NhNDc2Zjc5ZDk5MTI3NDdiYWFkYjMxYjAz
|
11
|
+
ODZhYzk0MWRkMjA1MDFjODFkZjBmOTI3ODY3Y2Y4YzBiYjU1Y2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Zjg5MjFkMzUzZWUyMzI3NWNhZTZkZWM3ZTNlZmY4OTU2YzExY2Y5MzU1ZTM3
|
14
|
+
MTA5YTdmNTZlMjhlMjliODkyODlmNmZkNDFiNjNlODMwYmUxYTFhYzJjMDMx
|
15
|
+
MzkxYmYwOWVhMjY0NGY2OGY3ZGExNGMzMjVkNjFkNzM5NmExNDU=
|
data/Rakefile
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
require 'rake/testtask'
|
2
|
+
|
3
|
+
Rake::TestTask.new(:test) do |test|
|
4
|
+
test.libs << 'test'
|
5
|
+
test.pattern = 'test/**/test_*.rb'
|
6
|
+
test.warning = false
|
7
|
+
test.verbose = true
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :test
|
11
|
+
|
1
12
|
require 'rake/clean'
|
13
|
+
|
2
14
|
CLEAN.include "**/*.rbc"
|
3
15
|
CLEAN.include "**/.DS_Store"
|
data/lib/puppy.rb
CHANGED
@@ -65,6 +65,8 @@ module Puppy
|
|
65
65
|
:stream => STDERR
|
66
66
|
}
|
67
67
|
|
68
|
+
# Initializes the traced object instance with the original instance,
|
69
|
+
# options and conditional tracing block.
|
68
70
|
def initialize( obj, opts = {}, &block )
|
69
71
|
@is_puppy_traced = true
|
70
72
|
@object, @opts, @block = obj, DEFAULTS.merge(opts), block
|
@@ -77,20 +79,28 @@ module Puppy
|
|
77
79
|
@object.send :inspect
|
78
80
|
end
|
79
81
|
|
82
|
+
# Make the user capable of tracing/untracing the object programmatically
|
83
|
+
# without creating a new TracedObject instance.
|
84
|
+
|
85
|
+
# Enables tracing.
|
80
86
|
def trace
|
81
87
|
@is_puppy_traced = true
|
82
88
|
end
|
83
89
|
|
90
|
+
# Disables tracing.
|
84
91
|
def untrace
|
85
92
|
@is_puppy_traced = false
|
86
93
|
end
|
87
94
|
|
88
|
-
# Here it goes,
|
95
|
+
# Here it goes, every method invoked on this object will trigger
|
96
|
+
# TracedObject#method_missing since we've undefined every instance
|
97
|
+
# method. This will make us able to print method call and arguments,
|
98
|
+
# and then invoke the original method using Object#send on the
|
99
|
+
# original instance.
|
89
100
|
def method_missing( m, *args )
|
90
101
|
begin
|
91
102
|
if ( @block == nil || @block.call( @object, m, *args ) == true ) && @is_puppy_traced == true
|
92
103
|
@stream << '# '
|
93
|
-
|
94
104
|
@stream << ' ' * caller.size unless !@opts[:indent]
|
95
105
|
|
96
106
|
as = @opts[:as]
|
data/puppy.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simone Margaritelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Puppy is a tiny gem to perform easy object tracing and debugging.
|
14
14
|
email: evilsocket@gmail.com
|