Commit
…hierarchy. Last call wins.
- Loading branch information
There are no files selected for viewing
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
|
@@ -70,6 +70,10 @@ def count_observers | ||
observer_instances.size | observer_instances.size | ||
end | end | ||
|
|
||
def subclasses | |||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
josevalim
Contributor
|
|||
@subclasses ||= [] | |||
end | |||
|
|||
protected | protected | ||
def instantiate_observer(observer) #:nodoc: | def instantiate_observer(observer) #:nodoc: | ||
# string/symbol | # string/symbol | ||
|
@@ -89,6 +93,7 @@ def instantiate_observer(observer) #:nodoc: | ||
# Notify observers when the observed class is subclassed. | # Notify observers when the observed class is subclassed. | ||
def inherited(subclass) | def inherited(subclass) | ||
super | super | ||
subclasses << subclass | |||
notify_observers :observed_class_inherited, subclass | notify_observers :observed_class_inherited, subclass | ||
end | end | ||
end | end | ||
|
This is going to leak memory like crazy in development.