instance method
gsub_file
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v2.3.18Available in: v2.2.3 v2.3.18
Signature
gsub_file(relative_destination, regexp, *args, &block)
No documentation comment.
Parameters
-
relative_destinationreq -
regexpreq -
argsrest -
blockblock
Source
# File railties/lib/rails_generator/commands.rb, line 92
def gsub_file(relative_destination, regexp, *args, &block)
path = destination_path(relative_destination)
content = File.read(path).gsub(regexp, *args, &block)
File.open(path, 'wb') { |file| file.write(content) }
end
Defined in railties/lib/rails_generator/commands.rb line 92
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generator::Commands::Base