Class | Class |
In: |
lib/merb-core/core_ext/class.rb
|
Parent: | Object |
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.
EMPTY_INHERITABLE_ATTRIBUTES | = | {}.freeze unless const_defined?(:EMPTY_INHERITABLE_ATTRIBUTES) | Prevent this constant from being created multiple times |
inherited | -> | inherited_without_inheritable_attributes |
Defines class-level (and optionally instance-level) attribute accessor.
*syms<Array>: | Array of attributes to define accessor for. |
:instance_writer<Boolean>: | if true, instance-level attribute writer is defined. |
Defines class-level and instance-level attribute reader.
*syms<Array>: | Array of attributes to define reader for. |
Defines class-level (and optionally instance-level) attribute writer.
*syms<Array>: | Array of attributes to define writer for. |
:instance_writer<Boolean>: | if true, instance-level attribute writer is defined. |
Defines class-level inheritable attribute accessor. Attributes are available to subclasses, each subclass has a copy of parent‘s attribute.
*syms<Array>: | Array of attributes to define inheritable accessor for. |
:instance_writer<Boolean>: | if true, instance-level inheritable attribute writer is defined. |
Defines class-level inheritable array accessor. Arrays are available to subclasses, each subclass has a copy of parent‘s array. Difference between other inheritable attributes is that array is recreated every time it is written.
*syms<Array>: | Array of array attribute names to define inheritable accessor for. |
:instance_writer<Boolean>: | if true, instance-level inheritable array attribute writer is defined. |
Defines class-level inheritable array writer. Arrays are available to subclasses, each subclass has a copy of parent‘s array. Difference between other inheritable attributes is that array is recreated every time it is written.
*syms<Array>: | Array of array attribute names to define inheritable writer for. |
:instance_writer<Boolean>: | if true, instance-level inheritable array attribute writer is defined. |
Defines class-level inheritable hash accessor. Hashs are available to subclasses, each subclass has a copy of parent‘s hash. Difference between other inheritable attributes is that hash is recreated every time it is written.
*syms<Array>: | Array of hash attribute names to define inheritable accessor for. |
:instance_writer<Boolean>: | if true, instance-level inheritable hash attribute writer is defined. |
Defines class-level inheritable hash writer. Hashs are available to subclasses, each subclass has a copy of parent‘s hash. Difference between other inheritable attributes is that hash is recreated every time it is written.
*syms<Array>: | Array of hash attribute names to define inheritable writer for. |
:instance_writer<Boolean>: | if true, instance-level inheritable hash attribute writer is defined. |
Defines class-level inheritable attribute reader. Attributes are available to subclasses, each subclass has a copy of parent‘s attribute.
*syms<Array>: | Array of attributes to define inheritable reader for. |
Defines class-level inheritable attribute writer. Attributes are available to subclasses, each subclass has a copy of parent‘s attribute.
*syms<Array>: | Array of attributes to define inheritable writer for. |
:instance_writer<Boolean>: | if true, instance-level inheritable attribute writer is defined. |
Reads value of inheritable attributes.
Inheritable attribute value. Subclasses store copies of values.
Resets inheritable attributes to either EMPTY_INHERITABLE_ATTRIBUTES if it is defined or it‘s default value, new frozen Hash.
Sets the array attribute which copy is available to subclasses.
key<~to_s, String, Symbol>: | inheritable attribute name |
value<Array>: | value of inheritable attribute |
Inheritable array is re-created on each write.
Sets the attribute which copy is available to subclasses.
key<~to_s, String, Symbol>: | inheritable attribute name |
value<Anything but Array or Hash>: | value of inheritable attribute |
If inheritable attributes storage has it‘s default value, a new frozen hash, it is set to new Hash that is not frozen.