aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-10-17 15:52:32 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-10-18 17:08:24 -0300
commitb9fcce3944653db5eb49119c134e8525e91f7aee (patch)
treed7f52ceff25a8faf094ddd6a3ecaffde191d2280 /railties/lib/rails
parent7b71d8cfabe71dc9cf265809eed51e6956b60b7f (diff)
downloadrails-b9fcce3944653db5eb49119c134e8525e91f7aee.tar.gz
rails-b9fcce3944653db5eb49119c134e8525e91f7aee.tar.bz2
rails-b9fcce3944653db5eb49119c134e8525e91f7aee.zip
Merge pull request #17302 from claudiob/replace-slower-block-call-with-faster-yield
Replace (slower) block.call with (faster) yield
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/generators/actions.rb4
-rw-r--r--railties/lib/rails/generators/actions/create_migration.rb4
2 files changed, 4 insertions, 4 deletions
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index b2c9d12996..ffdb314612 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -85,10 +85,10 @@ module Rails
# environment(nil, env: "development") do
# "config.autoload_paths += %W(#{config.root}/extras)"
# end
- def environment(data=nil, options={}, &block)
+ def environment(data=nil, options={})
sentinel = /class [a-z_:]+ < Rails::Application/i
env_file_sentinel = /Rails\.application\.configure do/
- data = block.call if !data && block_given?
+ data = yield if !data && block_given?
in_root do
if options[:env].nil?
diff --git a/railties/lib/rails/generators/actions/create_migration.rb b/railties/lib/rails/generators/actions/create_migration.rb
index 682092fdf2..cffdef6ec9 100644
--- a/railties/lib/rails/generators/actions/create_migration.rb
+++ b/railties/lib/rails/generators/actions/create_migration.rb
@@ -39,7 +39,7 @@ module Rails
protected
- def on_conflict_behavior(&block)
+ def on_conflict_behavior
options = base.options.merge(config)
if identical?
say_status :identical, :blue, relative_existing_migration
@@ -48,7 +48,7 @@ module Rails
say_status :create, :green
unless pretend?
::FileUtils.rm_rf(existing_migration)
- block.call
+ yield
end
elsif options[:skip]
say_status :skip, :yellow