instance method render_file

Ruby on Rails 2.2.3

Since v2.2.3 Last seen in v2.3.18 Private

Available in: v2.2.3 v2.3.18

Signature

render_file(path, options = {})

No documentation comment.

Parameters

path req
options opt = {}
Source
# File railties/lib/rails_generator/commands.rb, line 371
          def render_file(path, options = {})
            File.open(path, 'rb') do |file|
              if block_given?
                yield file
              else
                content = ''
                if shebang = options[:shebang]
                  content << "#!#{shebang}\n"
                  if line = file.gets
                    content << "line\n" if line !~ /^#!/
                  end
                end
                content << file.read
              end
            end
          end

Defined in railties/lib/rails_generator/commands.rb line 371 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Rails::Generator::Commands::Create

Type at least 2 characters to search.

↑↓ navigate · open · esc close