module Launchy::DescendantTracker
def children
The list of children that are registered
def children @children = [] unless defined? @children @children end
def find_child(method, *args)
and passing all the rest of the parameters to that method in
Find one of the child classes by calling the given method
def find_child(method, *args) children.find do |child| Launchy.log "Checking if class #{child} is the one for #{method}(#{args.join(', ')})}" child.send(method, *args) end end
def inherited(klass)
def inherited(klass) super return unless klass.instance_of?(Class) children << klass end