Skip to content

Commit

Permalink
Fix ERB template line numbers in Ruby 1.9
Browse files Browse the repository at this point in the history
because ERB adds an encoding comment
  • Loading branch information
Justin Collins committed Jun 29, 2011
1 parent 2b66d02 commit 41ba6ed
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ErubisEscape < ScannerErubis

#Scans the Rails application.
class Scanner
RUBY_1_9 = !!(RUBY_VERSION =~ /^1\.9/)

#Pass in path to the root of the Rails application
def initialize path
Expand Down Expand Up @@ -161,6 +162,7 @@ def process_templates
src = ScannerErubis.new(text).src
else
src = ERB.new(text, nil, "-").src
src.sub!(/^#.*\n/, '') if RUBY_1_9
end
parsed = RubyParser.new.parse src
elsif type == :haml
Expand Down

0 comments on commit 41ba6ed

Please sign in to comment.