aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template/error.rb
diff options
context:
space:
mode:
authorLucas Uyezu <lucas.uyezu@gmail.com>2012-08-02 21:23:06 -0300
committerLucas Uyezu <lucas.uyezu@gmail.com>2012-08-13 18:49:47 -0300
commit6446e84c1a0d72ecdba1046c3e15b4467eae9e5b (patch)
tree81293ce71ce3f5038257f5d426a44265c61104c4 /actionpack/lib/action_view/template/error.rb
parentfa736e69a197522ae3af3d3e6394cdc1eb1da228 (diff)
downloadrails-6446e84c1a0d72ecdba1046c3e15b4467eae9e5b.tar.gz
rails-6446e84c1a0d72ecdba1046c3e15b4467eae9e5b.tar.bz2
rails-6446e84c1a0d72ecdba1046c3e15b4467eae9e5b.zip
Indentation should consider line number character count.
Diffstat (limited to 'actionpack/lib/action_view/template/error.rb')
-rw-r--r--actionpack/lib/action_view/template/error.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/template/error.rb b/actionpack/lib/action_view/template/error.rb
index d8258f7b11..f2bef4bded 100644
--- a/actionpack/lib/action_view/template/error.rb
+++ b/actionpack/lib/action_view/template/error.rb
@@ -84,13 +84,13 @@ module ActionView
start_on_line = [ num - SOURCE_CODE_RADIUS - 1, 0 ].max
end_on_line = [ num + SOURCE_CODE_RADIUS - 1, source_code.length].min
- indent = ' ' * indentation
+ indent = end_on_line.to_s.size + indentation
line_counter = start_on_line
return unless source_code = source_code[start_on_line..end_on_line]
source_code.sum do |line|
line_counter += 1
- "#{indent}#{line_counter}: #{line}\n"
+ "%#{indent}s: %s\n" % [line_counter, line]
end
end