Permalink
Browse files

Merge pull request #8 from americodls/master

prevent duplication of comments
  • Loading branch information...
2 parents 3de60d4 + ea62967 commit a0e1a8c9d0a44e71ef7249a3ed701172572744e1 @mryan43 committed Sep 11, 2012
Showing with 3 additions and 6 deletions.
  1. 0 Changelog → CHANGELOG
  2. +3 −6 lib/magic_encoding.rb
View
File renamed without changes.
View
@@ -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))

0 comments on commit a0e1a8c

Please sign in to comment.