blob: 7749f0b165dcdfe656d209993ee781041894fcad (
plain) (
tree)
|
|
# 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
module OnlySubclasses
class << self
def included(base) #nodoc:
base.send :include, Reloadable
(class << base; self; end;).class_eval do
define_method(:reloadable?) { self != base }
end
end
end
end
end
|