class_attr 0.1.2 → 0.1.3
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.
- data/LICENSE +2 -5
- data/README.md +12 -2
- data/lib/class_attr.rb +2 -2
- metadata +3 -3
data/LICENSE
CHANGED
@@ -5,11 +5,8 @@ a copy of this software and associated documentation files (the
|
|
5
5
|
"Software"), to deal in the Software without restriction, including
|
6
6
|
without limitation the rights to use, copy, modify, merge, publish,
|
7
7
|
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so,
|
9
|
-
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
8
|
+
permit persons to whom the Software is furnished to do so, there are
|
9
|
+
no conditions to fulfill.
|
13
10
|
|
14
11
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
12
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
data/README.md
CHANGED
@@ -48,14 +48,24 @@ make it more clear:
|
|
48
48
|
Agent.legs #=> 2
|
49
49
|
|
50
50
|
|
51
|
-
|
51
|
+
## Install
|
52
52
|
|
53
53
|
(sudo) gem install class_attr
|
54
54
|
|
55
55
|
|
56
|
-
|
56
|
+
## Use
|
57
57
|
|
58
58
|
require 'class_attr'
|
59
|
+
|
60
|
+
Or, as in some cases this may be overkill, copy the parts you need over (you will need to modify it,
|
61
|
+
but that should be easy to work out.)
|
62
|
+
|
63
|
+
|
64
|
+
### Important!
|
65
|
+
|
66
|
+
If in a class you define the `self.inherited` method, make sure to call super at the end (or beginning)
|
67
|
+
otherwise default values will not be set for the subclass. But I'm guessing you already called super
|
68
|
+
anyway in a method like that.
|
59
69
|
|
60
70
|
|
61
71
|
## Thanks
|
data/lib/class_attr.rb
CHANGED
@@ -38,7 +38,7 @@ class Class
|
|
38
38
|
self.class.send(:#{name})
|
39
39
|
end
|
40
40
|
EOS
|
41
|
-
self.instance_variable_set("@#{name}", default)
|
41
|
+
self.instance_variable_set("@#{name}", (default.dup rescue default))
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -117,7 +117,7 @@ class Class
|
|
117
117
|
self.class.send(:#{name})
|
118
118
|
end
|
119
119
|
EOS
|
120
|
-
self.instance_variable_set("@#{name}", default)
|
120
|
+
self.instance_variable_set("@#{name}", (default.dup rescue default))
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 3
|
9
|
+
version: 0.1.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Joshua Hawxwell
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-02-10 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|