Class: RailsUpgrade::Upgraders::RouteGenerator
- Inherits:
-
Object
- Object
- RailsUpgrade::Upgraders::RouteGenerator
- Defined in:
- lib/rails-upgrade/upgraders/routes.rb
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(routes) ⇒ RouteGenerator
constructor
A new instance of RouteGenerator.
Constructor Details
#initialize(routes) ⇒ RouteGenerator
Returns a new instance of RouteGenerator.
282 283 284 285 |
# File 'lib/rails-upgrade/upgraders/routes.rb', line 282 def initialize(routes) @routes = routes @new_code = "" end |
Instance Method Details
#generate ⇒ Object
287 288 289 290 291 292 293 |
# File 'lib/rails-upgrade/upgraders/routes.rb', line 287 def generate @new_code = @routes.map do |r| r.to_route_code end.join("\n") "#{app_name.classify}::Application.routes do\n#{@new_code}\nend\n" end |