state_inspector 0.8.0 → 0.8.1
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.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/state_inspector/snoop.rb +16 -12
- data/lib/state_inspector/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d5cb038068fa7183077900d356b5986a9b2ddf48
|
4
|
+
data.tar.gz: 208d426f3459f1d5d3002f5a402d800da5bdb8f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89702420071e816b9e4ad58a83506df05c7065eb2b825e77ecded1003c32baac84207fd6bd738b0e8b402e948c4ddaa7b3230fb5440713631d2e8aff52c92265
|
7
|
+
data.tar.gz: f49460d203703dda01715a0eee99bbb2026a2a38760e672aade3060fc524a9c65158d6bf05072fa2201bd94482151b07d5b192d14ca01c3f55c217f881bef4bc
|
data/README.md
CHANGED
@@ -54,8 +54,8 @@ of the object, method, old value, and new value. So you will see what is change
|
|
54
54
|
the order that the changed occurred. This session logger will grab as many objects state changes
|
55
55
|
as you want and give you a nice ordered history of what has occurred.
|
56
56
|
|
57
|
-
If you don't want to inform on all instances of
|
58
|
-
on the class then execute that method on
|
57
|
+
If you don't want to inform on all instances of a class then instead of running `toggle_informant`
|
58
|
+
on the class itself then simply execute that method on the instances you want to observe.
|
59
59
|
|
60
60
|
If you want to see the expected results of the current observer/reporters then see [test/reporter_test.rb](https://github.com/danielpclark/state_inspector/blob/master/test/reporter_test.rb).
|
61
61
|
|
@@ -109,7 +109,7 @@ end
|
|
109
109
|
And to register this observer to a target class you simply write:
|
110
110
|
|
111
111
|
```ruby
|
112
|
-
StateInspector::Reporter[
|
112
|
+
StateInspector::Reporter[MyTargetClass] = ExampleObserver
|
113
113
|
```
|
114
114
|
|
115
115
|
|
@@ -7,23 +7,27 @@ module StateInspector
|
|
7
7
|
base.include ClassMethods
|
8
8
|
end
|
9
9
|
|
10
|
-
def attr_writer
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
def attr_writer *attr_names
|
11
|
+
attr_names.each do |attr_name|
|
12
|
+
define_method("#{attr_name}=") do |value|
|
13
|
+
tell_si __method__.to_s.chop,
|
14
|
+
instance_variable_get("@#{attr_name.to_s}"),
|
15
|
+
value
|
16
|
+
|
17
|
+
instance_variable_set("@#{attr_name.to_s}", value)
|
18
|
+
end
|
17
19
|
end
|
18
20
|
nil
|
19
21
|
end
|
20
22
|
|
21
|
-
def attr_accessor
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
def attr_accessor *attr_names
|
24
|
+
attr_names.each do |attr_name|
|
25
|
+
define_method("#{attr_name}") do
|
26
|
+
instance_variable_get("@#{attr_name.to_s}")
|
27
|
+
end
|
25
28
|
|
26
|
-
|
29
|
+
self.attr_writer(attr_name)
|
30
|
+
end
|
27
31
|
end
|
28
32
|
|
29
33
|
module ClassMethods
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_inspector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel P. Clark
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|