instance method gsub_file

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

gsub_file(relative_destination, regexp, *args, &block)

No documentation comment.

Parameters

relative_destination req
regexp req
args rest
block block
Source
# File railties/lib/rails_generator/commands.rb, line 91
          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 91 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Generator::Commands::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close