1 # These class attributes behave something like the class
2 # inheritable accessors. But instead of copying the hash over at
3 # the time the subclass is first defined, the accessors simply
4 # delegate to their superclass unless they have been given a
5 # specific value. This stops the strange situation where values
6 # set after class definition don't get applied to subclasses.
8 def superclass_delegating_reader(*names)
9 class_name_to_stop_searching_on = self.superclass.name.blank? ? "Object" : self.superclass.name
15 elsif superclass < #{class_name_to_stop_searching_on} && superclass.respond_to?(:#{name})
26 def superclass_delegating_writer(*names)
29 def self.#{name}=(value)
36 def superclass_delegating_accessor(*names)
37 superclass_delegating_reader(*names)
38 superclass_delegating_writer(*names)