Skip to content

Commit 3c2fe5e

Browse files
author
Mateusz Michalski
committed
Add default config in insert_into_file method
1 parent edb975f commit 3c2fe5e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/thor/actions/inject_into_file.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ module Actions
2323
#
2424
def insert_into_file(destination, *args, &block)
2525
data = block_given? ? block : args.shift
26-
config = args.shift
26+
default_config = { after: "Rails::Initializer.run do |config|\n" }
27+
28+
config = (args.shift || default_config)
29+
config.merge!(after: default_config[:after]) if (config.is_a?(Hash) && !config.key?(:after))
30+
2731
action InjectIntoFile.new(self, destination, data, config)
2832
end
2933
alias_method :inject_into_file, :insert_into_file

0 commit comments

Comments
 (0)