aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/reloadable.rb
blob: 49e6442a373235b0d45f3f79d83610e071c255f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Classes that include this module will automatically be reloaded
# by the Rails dispatcher when Dependencies.mechanism = :load.
module Reloadable
  class << self
    def included(base) #nodoc:
      if base.is_a?(Class) && ! base.respond_to?(:reloadable?)
        class << base
          define_method(:reloadable?) { true }
        end
      end
    end
    
    def reloadable_classes
      included_in_classes.select { |klass| klass.reloadable? }
    end
  end
end