lib/replace_quotes.rb in replace_quotes-0.0.0 vs lib/replace_quotes.rb in replace_quotes-0.0.1
- old
+ new
@@ -7,10 +7,12 @@
return if StringInFile.present('"', path) != true
path_old = path
path_new = "#{path_old}.new"
file_w = open(path_new, 'w')
File.readlines(path_old).each do |line|
- if (line.include? '"') == true && (line.include? "'") == false
+ single_quote = (line.include? "'")
+ pound_cb = (line.include? '#{')
+ if (single_quote == false) && (pound_cb == false)
line_alt = line.tr('"', "'")
file_w.write(line_alt)
else
file_w.write(line)
end