Class: Rails::Application::RoutesReloader
- Inherits:
-
Object
- Object
- Rails::Application::RoutesReloader
- Includes:
- ActiveSupport::Callbacks
- Defined in:
- lib/rails/application/routes_reloader.rb
Instance Attribute Summary collapse
-
#eager_load ⇒ Object
Returns the value of attribute eager_load.
-
#external_routes ⇒ Object
readonly
Returns the value of attribute external_routes.
-
#loaded ⇒ Object
Returns the value of attribute loaded.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
-
#route_sets ⇒ Object
readonly
Returns the value of attribute route_sets.
-
#run_after_load_paths ⇒ Object
writeonly
:nodoc:.
Instance Method Summary collapse
- #execute ⇒ Object
- #execute_unless_loaded ⇒ Object
-
#initialize ⇒ RoutesReloader
constructor
A new instance of RoutesReloader.
- #reload! ⇒ Object
Constructor Details
#initialize ⇒ RoutesReloader
14 15 16 17 18 19 20 |
# File 'lib/rails/application/routes_reloader.rb', line 14 def initialize @paths = [] @route_sets = [] @external_routes = [] @eager_load = false @loaded = false end |
Instance Attribute Details
#eager_load ⇒ Object
Returns the value of attribute eager_load.
10 11 12 |
# File 'lib/rails/application/routes_reloader.rb', line 10 def eager_load @eager_load end |
#external_routes ⇒ Object (readonly)
Returns the value of attribute external_routes.
9 10 11 |
# File 'lib/rails/application/routes_reloader.rb', line 9 def external_routes @external_routes end |
#loaded ⇒ Object
Returns the value of attribute loaded.
9 10 11 |
# File 'lib/rails/application/routes_reloader.rb', line 9 def loaded @loaded end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
9 10 11 |
# File 'lib/rails/application/routes_reloader.rb', line 9 def paths @paths end |
#route_sets ⇒ Object (readonly)
Returns the value of attribute route_sets.
9 10 11 |
# File 'lib/rails/application/routes_reloader.rb', line 9 def route_sets @route_sets end |
#run_after_load_paths=(value) ⇒ Object
:nodoc:
11 12 13 |
# File 'lib/rails/application/routes_reloader.rb', line 11 def run_after_load_paths=(value) @run_after_load_paths = value end |
Instance Method Details
#execute ⇒ Object
31 32 33 34 |
# File 'lib/rails/application/routes_reloader.rb', line 31 def execute @loaded = true updater.execute end |
#execute_unless_loaded ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/rails/application/routes_reloader.rb', line 36 def execute_unless_loaded unless @loaded execute ActiveSupport.run_load_hooks(:after_routes_loaded, Rails.application) true end end |
#reload! ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/rails/application/routes_reloader.rb', line 22 def reload! clear! load_paths finalize! route_sets.each(&:eager_load!) if eager_load ensure revert end |