method
class_inheritable_hash
v2.2.1 -
Show latest stable
- Class:
Class
class_inheritable_hash(*syms)public
No documentation available.
# File activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb, line 90
def class_inheritable_hash(*syms)
class_inheritable_reader(*syms)
class_inheritable_hash_writer(*syms)
end 1Note
Merges with inherited values from super class
http://www.spacevatican.org/2008/8/19/fun-with-class-variables
"When you set a class_inheritable_array or a class_inheritable_hash you are actually concatenating (or merging) with the value inherited from the super class."
==== Code example
class Base
class_inheritable_hash :attrs
self.attrs = {:name => 'Fred'}
end
class Derived < Base
self.attrs = {:export => 'Pain'}
end
Derived.attrs #=> {:name => 'Fred', :export => 'Pain'}