Skip to content
Browse files

sub (not gsub) in case of multiple matches

  • Loading branch information...
1 parent 86766c4 commit 7f4e231db281cea9d44bcee5c2818d0f3bb03824 @croaky croaky committed with thoughtbot-travis Jun 5, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 install.rb
View
2 install.rb
@@ -3,5 +3,5 @@
puts "inserting #{line} into #{path}"
-content = File.read(path).gsub(/^(end\s*)$/) {|match| " #{line}\n#{match}" }
+content = File.read(path).sub(/^(end\s*)$/) {|match| " #{line}\n#{match}" }
File.open(path, 'wb') { |file| file.write(content) }

0 comments on commit 7f4e231

Please sign in to comment.
Something went wrong with that request. Please try again.