aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/application/routes_reloader.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-27 17:39:35 +0100
committerCarl Lerche <carllerche@mac.com>2010-01-28 10:28:40 -0800
commit226d8e745a0d47efa50633661a2b7fe1859609bc (patch)
tree3acf231ae9a3dc29bb44e59d34161abfc2eb9f5c /railties/lib/rails/application/routes_reloader.rb
parent252911e37897e1fd6f353f8e2002de3031275612 (diff)
downloadrails-226d8e745a0d47efa50633661a2b7fe1859609bc.tar.gz
rails-226d8e745a0d47efa50633661a2b7fe1859609bc.tar.bz2
rails-226d8e745a0d47efa50633661a2b7fe1859609bc.zip
Refactor MetalLoader and RoutesReloader to rely less on class configuration.
Signed-off-by: Carl Lerche <carllerche@mac.com>
Diffstat (limited to 'railties/lib/rails/application/routes_reloader.rb')
-rw-r--r--railties/lib/rails/application/routes_reloader.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/railties/lib/rails/application/routes_reloader.rb b/railties/lib/rails/application/routes_reloader.rb
index fe0cfb7801..fde6211c5d 100644
--- a/railties/lib/rails/application/routes_reloader.rb
+++ b/railties/lib/rails/application/routes_reloader.rb
@@ -1,19 +1,16 @@
module Rails
class Application
- # TODO Write tests for this behavior extracted from Application
class RoutesReloader
- def self.paths
- @paths ||= []
- end
+ attr_reader :paths
- def initialize(config)
- @config, @last_change_at = config, nil
+ def initialize
+ @paths, @last_change_at = [], nil
end
def changed_at
routes_changed_at = nil
- self.class.paths.each do |path|
+ paths.each do |path|
config_changed_at = File.stat(path).mtime
if routes_changed_at.nil? || config_changed_at > routes_changed_at
@@ -29,7 +26,7 @@ module Rails
routes.disable_clear_and_finalize = true
routes.clear!
- self.class.paths.each { |path| load(path) }
+ paths.each { |path| load(path) }
routes.finalize!
nil