Skip to content

Commit

Permalink
fixing search by existing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
americodls committed Sep 11, 2012
1 parent 3de60d4 commit ea62967
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
File renamed without changes.
9 changes: 3 additions & 6 deletions lib/magic_encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ def self.process(options)
lines = file.readlines

# remove current encoding comment(s)
while lines[0] && (
lines[0].starts_with?(comment_style.sub('{text}', 'encoding')) ||
lines[0].starts_with?(comment_style.sub('{text}', 'coding')) ||
lines[0].starts_with?(comment_style.sub('{text}', '-*- encoding')))
lines.shift
end
while lines[0].match(/^-?# ?(-\*-)? ?(en)?coding/)
lines.shift
end

# set current encoding
lines.insert(0,comment_style.sub('{text}', prefix))
Expand Down

0 comments on commit ea62967

Please sign in to comment.