aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorSıtkı Bağdat <sbagdat@gmail.com>2013-11-21 01:52:09 +0200
committerSıtkı Bağdat <sbagdat@gmail.com>2013-11-21 18:35:58 +0200
commit6701b4cf41f6f3d9cfc6a93715acbf852d1e468e (patch)
tree7bd656d38aaabf81d9df2039e40cf4f59d08de60 /actionpack/lib
parent64b9e93bb571160315987862583a83222e506734 (diff)
downloadrails-6701b4cf41f6f3d9cfc6a93715acbf852d1e468e.tar.gz
rails-6701b4cf41f6f3d9cfc6a93715acbf852d1e468e.tar.bz2
rails-6701b4cf41f6f3d9cfc6a93715acbf852d1e468e.zip
Fix for routes task
This commit fixes formatting issue for `rake routes` task, when a section is shorter than a header.
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_dispatch/routing/inspector.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/inspector.rb b/actionpack/lib/action_dispatch/routing/inspector.rb
index cffb814e1e..120bc54333 100644
--- a/actionpack/lib/action_dispatch/routing/inspector.rb
+++ b/actionpack/lib/action_dispatch/routing/inspector.rb
@@ -179,7 +179,8 @@ module ActionDispatch
private
def draw_section(routes)
- name_width, verb_width, path_width = widths(routes)
+ header_lengths = ['Prefix', 'Verb', 'URI Pattern'].map(&:length)
+ name_width, verb_width, path_width = widths(routes).zip(header_lengths).map(&:max)
routes.map do |r|
"#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:path].ljust(path_width)} #{r[:reqs]}"