diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index 23d53fb598630..d3db662fe4091 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -261,14 +261,17 @@ def vendor(filename, data = nil) create_file("vendor/#{filename}", optimize_indentation(data), verbose: false) end - # Create a new file in the lib/ directory. Code can be specified - # in a block or a data string can be given. + # Creates a file in +lib/+. The contents can be specified as an argument + # or as the return value of the block. # - # lib("crypto.rb") do - # "crypted_special_value = '#{rand}--#{Time.now}--#{rand(1337)}--'" + # lib "foreign.rb", <<~RUBY + # # Foreign code is fun + # RUBY + # + # lib "foreign.rb" do + # "# Foreign code is fun" # end # - # lib("foreign.rb", "# Foreign code is fun") def lib(filename, data = nil) log :lib, filename data ||= yield if block_given?