You've seen them hiding in read_inheritable_attribute, write_inheritable_attributes, write_inheritable_array, and write_inheritable_hash. You've wonder, how the heck can I have class attributes that are inherited into my subclasses?
class Foo
class_inheritable_reader :read_me
class_inheritable_writer :write_me
class_inheritable_accessor :read_and_write_me
class_inheritable_array :read_and_concat_me
class_inheritable_hash :read_and_update_me
end
# Bar gets a clone of (not a reference to) Foo's attributes.
class Bar < Foo
end
Bar.read_and_write_me == Foo.read_and_write_me
Bar.read_and_write_me = 'bar'
Bar.read_and_write_me != Foo.read_and_write_me
Reader makes class and instance reader methods, writer makes class and instance writer methods, accessor makes both. Array_writer and hash_writer make normal readers and writers which concatenation and update the argument, respectively.
Note that include ClassInheritableAttributes is no longer required since Class has these methods. The module has been retained for backward compatibility. A full test suite is included and all of Rails passes with the changes.