Class: ApiMaker::RoutesFileReloader
- Inherits:
-
ApplicationService
- Object
- ServicePattern::Service
- ApplicationService
- ApiMaker::RoutesFileReloader
- Defined in:
- app/services/api_maker/routes_file_reloader.rb
Instance Attribute Summary collapse
-
#file_paths ⇒ Object
readonly
Returns the value of attribute file_paths.
Instance Method Summary collapse
-
#initialize(file_paths:) ⇒ RoutesFileReloader
constructor
A new instance of RoutesFileReloader.
- #perform ⇒ Object
Methods inherited from ApplicationService
Constructor Details
#initialize(file_paths:) ⇒ RoutesFileReloader
Returns a new instance of RoutesFileReloader.
4 5 6 |
# File 'app/services/api_maker/routes_file_reloader.rb', line 4 def initialize(file_paths:) @file_paths = file_paths end |
Instance Attribute Details
#file_paths ⇒ Object (readonly)
Returns the value of attribute file_paths.
2 3 4 |
# File 'app/services/api_maker/routes_file_reloader.rb', line 2 def file_paths @file_paths end |
Instance Method Details
#perform ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/services/api_maker/routes_file_reloader.rb', line 8 def perform reloader = Rails.application.config.file_watcher.new(file_paths) do Rails.application.reload_routes! end Rails.application.reloaders << reloader Rails.application.reloader.to_run do reloader.execute_if_updated end succeed! end |