Class

Class

Extends:

These class attributes behave something like the class inheritable accessors. But instead of copying the hash over at the time the subclass is first defined, the accessors simply delegate to their superclass unless they have been given a specific value. This stops the strange situation where values set after class definition don’t get applied to subclasses.

From active_support/core_ext/class/attribute_accessors.rb

Extends the class object with class and instance accessors for class attributes, just like the native attr* accessors for instance attributes.

From active_support/core_ext/class/inheritable_attributes.rb

Allows attributes to be shared within an inheritance hierarchy, but where each descendant gets a copy of their parents’ attributes, instead of just a pointer to the same. This means that the child can add elements to, for example, an array without those additions being shared with either their parent, siblings, or children, which is unlike the regular class-level attributes that are shared across the entire hierarchy.

Constants
EMPTY_INHERITABLE_ATTRIBUTES Prevent this constant from being created multiple times
Aliases
inherited_without_inheritable_attributes
Public Methods
cattr_accessor
cattr_reader
cattr_writer
class_inheritable_accessor
class_inheritable_array
class_inheritable_array_writer
class_inheritable_hash
class_inheritable_hash_writer
class_inheritable_reader
class_inheritable_writer
const_missing
inheritable_attributes
read_inheritable_attribute
remove_class
remove_subclasses
reset_inheritable_attributes
subclasses
superclass_delegating_accessor
superclass_delegating_reader
superclass_delegating_writer
write_inheritable_array
write_inheritable_attribute
write_inheritable_hash
Private Methods
inherited Alias for #inherited_with_inheritable_attributes
inherited_with_inheritable_attributes
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.