class_attr 0.1.1 → 0.1.2
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/lib/class_attr.rb +2 -1
- metadata +2 -2
data/lib/class_attr.rb
CHANGED
@@ -183,7 +183,7 @@ class Class
|
|
183
183
|
@registered_defaults ||= {}
|
184
184
|
end
|
185
185
|
|
186
|
-
def inherited_with_attrs(klass)
|
186
|
+
def inherited_with_attrs(klass)
|
187
187
|
inherited_without_attrs(klass) if respond_to?(:inherited_without_attrs)
|
188
188
|
if registered_defaults
|
189
189
|
new_attrs = registered_defaults.inject({}) do |a, (k, v)|
|
@@ -196,6 +196,7 @@ class Class
|
|
196
196
|
new_attrs.each do |k, v|
|
197
197
|
klass.instance_variable_set("@#{k}", v)
|
198
198
|
end
|
199
|
+
klass.instance_variable_set("@registered_defaults", new_attrs)
|
199
200
|
end
|
200
201
|
alias inherited_without_attrs inherited
|
201
202
|
alias inherited inherited_with_attrs
|