hometown 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/lib/hometown/creation_tracer.rb +12 -1
- data/lib/hometown/version.rb +1 -1
- data/test/hometown_test.rb +11 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e29f7d37b61fb75c541fc7a1138f379e306432c
|
4
|
+
data.tar.gz: 8f3e58ab49f30c0a8b2844ee44bc4cbf52a53c08
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9c931736924f8fa3910d70a6546b07be98385eb093d60e52ca0a7923568e3392bb1a1e1acf4bd8b7e079defeb9818f5903fd6fc13b5c0846da81ec01eeeccb2
|
7
|
+
data.tar.gz: 175a2bb1946fb5177cf26f7237058c8393f240043a7e5ef578c94a3ce67f6f14ff1f90bec7c0be44b415589d7f50c48f5e860bca81d0d787639ac784f079a618
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# 0.2.5
|
2
|
+
-------
|
3
|
+
* Fix for crash when instantiating a subclass when superclass is watched
|
4
|
+
|
5
|
+
# 0.2.4
|
6
|
+
-------
|
7
|
+
* Nicer report output formatting
|
8
|
+
|
9
|
+
# 0.2.3
|
10
|
+
-------
|
11
|
+
* Rakefile fixes for gem releases
|
12
|
+
* Fix crash in disposal tracking if objects created before class is traced
|
13
|
+
|
14
|
+
# 0.2.2
|
15
|
+
-------
|
16
|
+
* Disposal tracking mode for objects
|
17
|
+
|
18
|
+
# 0.2.1
|
19
|
+
-------
|
20
|
+
* Fix for inaccurate stack scrubbing on Rubinius
|
21
|
+
|
22
|
+
# 0.2.0
|
23
|
+
-------
|
24
|
+
* First real version for primetime
|
@@ -33,7 +33,7 @@ module Hometown
|
|
33
33
|
class << self
|
34
34
|
def new_traced(*args, &blk)
|
35
35
|
instance = new_untraced(*args, &blk)
|
36
|
-
|
36
|
+
self.instance_hooks.each { |hook| hook.call(instance) }
|
37
37
|
instance
|
38
38
|
end
|
39
39
|
|
@@ -64,6 +64,17 @@ module Hometown
|
|
64
64
|
def update_on_instance_created(clazz, on_instance_created)
|
65
65
|
return unless on_instance_created
|
66
66
|
clazz.instance_eval do
|
67
|
+
def instance_hooks
|
68
|
+
hooks = (self.ancestors + [self]).map do |target|
|
69
|
+
target.instance_variable_get(:@instance_hooks)
|
70
|
+
end
|
71
|
+
|
72
|
+
hooks.flatten!
|
73
|
+
hooks.compact!
|
74
|
+
hooks.uniq!
|
75
|
+
hooks
|
76
|
+
end
|
77
|
+
|
67
78
|
@instance_hooks ||= []
|
68
79
|
@instance_hooks << on_instance_created
|
69
80
|
end
|
data/lib/hometown/version.rb
CHANGED
data/test/hometown_test.rb
CHANGED
@@ -8,6 +8,9 @@ class HometownTest < Minitest::Test
|
|
8
8
|
class Untraced
|
9
9
|
end
|
10
10
|
|
11
|
+
class SubclassOfTraced < Traced
|
12
|
+
end
|
13
|
+
|
11
14
|
class TracedWithBlock
|
12
15
|
def initialize(&blk)
|
13
16
|
blk.call
|
@@ -46,6 +49,14 @@ class HometownTest < Minitest::Test
|
|
46
49
|
assert_equal Traced, result.traced_class
|
47
50
|
end
|
48
51
|
|
52
|
+
def test_tracing_extends_to_subclasses
|
53
|
+
Hometown.watch(Traced)
|
54
|
+
traced_object = SubclassOfTraced.new
|
55
|
+
|
56
|
+
result = Hometown.for(traced_object)
|
57
|
+
assert_equal SubclassOfTraced, result.traced_class
|
58
|
+
end
|
59
|
+
|
49
60
|
def test_tracing_includes_this_file
|
50
61
|
Hometown.watch(Traced)
|
51
62
|
traced_object = Traced.new
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hometown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason R. Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -131,6 +131,7 @@ extra_rdoc_files: []
|
|
131
131
|
files:
|
132
132
|
- ".gitignore"
|
133
133
|
- ".travis.yml"
|
134
|
+
- CHANGELOG.md
|
134
135
|
- Gemfile
|
135
136
|
- Guardfile
|
136
137
|
- LICENSE.txt
|
@@ -168,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
169
|
version: '0'
|
169
170
|
requirements: []
|
170
171
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.
|
172
|
+
rubygems_version: 2.4.1
|
172
173
|
signing_key:
|
173
174
|
specification_version: 4
|
174
175
|
summary: Track object creation
|