class_inheritable_attributes 0.0.1 → 0.0.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.
@@ -2,17 +2,11 @@ require "class_inheritable_attributes/version"
|
|
2
2
|
|
3
3
|
require 'active_support/core_ext/object/duplicable'
|
4
4
|
require 'active_support/core_ext/array/extract_options'
|
5
|
-
require 'active_support/deprecation'
|
6
5
|
|
7
6
|
# Retained for backward compatibility. Methods are now included in Class.
|
8
7
|
module ClassInheritableAttributes # :nodoc:
|
9
|
-
DEPRECATION_WARNING_MESSAGE = "class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first"
|
10
8
|
end
|
11
9
|
|
12
|
-
# It is recommended to use <tt>class_attribute</tt> over methods defined in this file. Please
|
13
|
-
# refer to documentation for <tt>class_attribute</tt> for more information. Officially it is not
|
14
|
-
# deprecated but <tt>class_attribute</tt> is faster.
|
15
|
-
#
|
16
10
|
# Allows attributes to be shared within an inheritance hierarchy. Each descendant gets a copy of
|
17
11
|
# their parents' attributes, instead of just a pointer to the same. This means that the child can add elements
|
18
12
|
# to, for example, an array without those additions being shared with either their parent, siblings, or
|
@@ -40,7 +34,6 @@ end
|
|
40
34
|
# Person.new.hair_colors # => NoMethodError
|
41
35
|
class Class # :nodoc:
|
42
36
|
def class_inheritable_reader(*syms)
|
43
|
-
ActiveSupport::Deprecation.warn ClassInheritableAttributes::DEPRECATION_WARNING_MESSAGE
|
44
37
|
options = syms.extract_options!
|
45
38
|
syms.each do |sym|
|
46
39
|
next if sym.is_a?(Hash)
|
@@ -59,7 +52,6 @@ class Class # :nodoc:
|
|
59
52
|
end
|
60
53
|
|
61
54
|
def class_inheritable_writer(*syms)
|
62
|
-
ActiveSupport::Deprecation.warn ClassInheritableAttributes::DEPRECATION_WARNING_MESSAGE
|
63
55
|
options = syms.extract_options!
|
64
56
|
syms.each do |sym|
|
65
57
|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
@@ -77,7 +69,6 @@ class Class # :nodoc:
|
|
77
69
|
end
|
78
70
|
|
79
71
|
def class_inheritable_array_writer(*syms)
|
80
|
-
ActiveSupport::Deprecation.warn ClassInheritableAttributes::DEPRECATION_WARNING_MESSAGE
|
81
72
|
options = syms.extract_options!
|
82
73
|
syms.each do |sym|
|
83
74
|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
@@ -95,7 +86,6 @@ class Class # :nodoc:
|
|
95
86
|
end
|
96
87
|
|
97
88
|
def class_inheritable_hash_writer(*syms)
|
98
|
-
ActiveSupport::Deprecation.warn ClassInheritableAttributes::DEPRECATION_WARNING_MESSAGE
|
99
89
|
options = syms.extract_options!
|
100
90
|
syms.each do |sym|
|
101
91
|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
@@ -153,7 +143,6 @@ class Class # :nodoc:
|
|
153
143
|
end
|
154
144
|
|
155
145
|
def reset_inheritable_attributes
|
156
|
-
ActiveSupport::Deprecation.warn ClassInheritableAttributes::DEPRECATION_WARNING_MESSAGE
|
157
146
|
@inheritable_attributes = EMPTY_INHERITABLE_ATTRIBUTES
|
158
147
|
end
|
159
148
|
|