From 6701b4cf41f6f3d9cfc6a93715acbf852d1e468e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C4=B1tk=C4=B1=20Ba=C4=9Fdat?= Date: Thu, 21 Nov 2013 01:52:09 +0200 Subject: Fix for routes task This commit fixes formatting issue for `rake routes` task, when a section is shorter than a header. --- actionpack/lib/action_dispatch/routing/inspector.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_dispatch') 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]}" -- cgit v1.2.3