Sha256: 2da95704c553dd97e6344bc8392226a503c439233d2e2c7d8c483771ea24a984
Contents?: true
Size: 859 Bytes
Versions: 3
Compression:
Stored size: 859 Bytes
Contents
# 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: raise TypeError, "Only Classes can be Reloadable!" unless base.is_a? Class unless 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 # Captures the common pattern where a base class should not be reloaded, # but its subclasses should be. module Subclasses def self.included(base) #nodoc: base.send :include, Reloadable (class << base; self; end).send(:define_method, :reloadable?) do base != self end end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
activesupport-1.3.0 | lib/active_support/reloadable.rb |
activesupport-1.3.1 | lib/active_support/reloadable.rb |
monetra-ruby-0.0.6 | lib/monetra/active_support/reloadable.rb |