Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/deploytool/target.rb

Instance Method Summary collapse

Instance Method Details

#track_subclassesObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/deploytool/target.rb', line 4

def track_subclasses
  instance_eval %{
      def self.known_subclasses
        @__deploytool_subclasses
      end
      
      def self.add_known_subclass(s)
        superclass.add_known_subclass(s) if superclass.respond_to?(:inherited_tracking_subclasses)
        (@__deploytool_subclasses ||= []) << s
      end
      
      def self.inherited_tracking_subclasses(s)
        add_known_subclass(s)
        inherited_not_tracking_subclasses(s)
      end
      alias :inherited_not_tracking_subclasses :inherited
      alias :inherited :inherited_tracking_subclasses
  }
end