Class: Rails::Application::RoutesReloader

Inherits:
Object
  • Object
show all
Defined in:
lib/rails/application/routes_reloader.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRoutesReloader

Returns a new instance of RoutesReloader.



12
13
14
15
16
# File 'lib/rails/application/routes_reloader.rb', line 12

def initialize
  @paths      = []
  @route_sets = []
  @eager_load = false
end

Instance Attribute Details

#eager_loadObject

Returns the value of attribute eager_load.



9
10
11
# File 'lib/rails/application/routes_reloader.rb', line 9

def eager_load
  @eager_load
end

#pathsObject (readonly)

Returns the value of attribute paths.



8
9
10
# File 'lib/rails/application/routes_reloader.rb', line 8

def paths
  @paths
end

#route_setsObject (readonly)

Returns the value of attribute route_sets.



8
9
10
# File 'lib/rails/application/routes_reloader.rb', line 8

def route_sets
  @route_sets
end

Instance Method Details

#executeObject



26
27
28
29
30
# File 'lib/rails/application/routes_reloader.rb', line 26

def execute
  ret = updater.execute
  route_sets.each(&:eager_load!) if eager_load
  ret
end

#execute_if_updatedObject



32
33
34
35
36
37
# File 'lib/rails/application/routes_reloader.rb', line 32

def execute_if_updated
  if updated = updater.execute_if_updated
    route_sets.each(&:eager_load!) if eager_load
  end
  updated
end

#reload!Object



18
19
20
21
22
23
24
# File 'lib/rails/application/routes_reloader.rb', line 18

def reload!
  clear!
  load_paths
  finalize!
ensure
  revert
end