aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-11-14 11:29:28 -0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-11-14 11:29:28 -0800
commit84961dc5df86c70504bdcdc218799e9f848a7a00 (patch)
tree14b7072cf0eb29cfb57cdadb2f70d51f454db7de
parenta23bf6f55a2bea50ec39cc744e17c924d727c089 (diff)
parentd3a1ce1cdc60d593de1682c5f4e3230c8db9a0fd (diff)
downloadrails-84961dc5df86c70504bdcdc218799e9f848a7a00.tar.gz
rails-84961dc5df86c70504bdcdc218799e9f848a7a00.tar.bz2
rails-84961dc5df86c70504bdcdc218799e9f848a7a00.zip
Merge pull request #12889 from kuldeepaggarwal/speed_ups
Used Yield instead of block.call
-rw-r--r--actionpack/lib/action_controller/metal/mime_responds.rb4
-rw-r--r--actionview/lib/action_view/helpers/atom_feed_helper.rb4
-rw-r--r--activerecord/test/cases/migrator_test.rb6
-rw-r--r--railties/lib/rails/generators/actions.rb4
4 files changed, 9 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/metal/mime_responds.rb b/actionpack/lib/action_controller/metal/mime_responds.rb
index 84ade41036..bcd21dbabc 100644
--- a/actionpack/lib/action_controller/metal/mime_responds.rb
+++ b/actionpack/lib/action_controller/metal/mime_responds.rb
@@ -358,10 +358,10 @@ module ActionController #:nodoc:
#
# Sends :not_acceptable to the client and returns nil if no suitable format
# is available.
- def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
+ def retrieve_collector_from_mimes(mimes = nil) #:nodoc:
mimes ||= collect_mimes_from_class_level
collector = Collector.new(mimes)
- block.call(collector) if block_given?
+ yield(collector) if block_given?
format = collector.negotiate_format(request)
if format
diff --git a/actionview/lib/action_view/helpers/atom_feed_helper.rb b/actionview/lib/action_view/helpers/atom_feed_helper.rb
index af70a4242a..1df52cd4b5 100644
--- a/actionview/lib/action_view/helpers/atom_feed_helper.rb
+++ b/actionview/lib/action_view/helpers/atom_feed_helper.rb
@@ -135,11 +135,11 @@ module ActionView
# Delegate to xml builder, first wrapping the element in a xhtml
# namespaced div element if the method and arguments indicate
# that an xhtml_block? is desired.
- def method_missing(method, *arguments, &block)
+ def method_missing(method, *arguments)
if xhtml_block?(method, arguments)
@xml.__send__(method, *arguments) do
@xml.div(:xmlns => 'http://www.w3.org/1999/xhtml') do |xhtml|
- block.call(xhtml)
+ yield(xhtml)
end
end
else
diff --git a/activerecord/test/cases/migrator_test.rb b/activerecord/test/cases/migrator_test.rb
index 3f9854200d..eaaf996dbb 100644
--- a/activerecord/test/cases/migrator_test.rb
+++ b/activerecord/test/cases/migrator_test.rb
@@ -346,11 +346,11 @@ module ActiveRecord
end
private
- def m(name, version, &block)
+ def m(name, version)
x = Sensor.new name, version
x.extend(Module.new {
- define_method(:up) { block.call(:up, x); super() }
- define_method(:down) { block.call(:down, x); super() }
+ define_method(:up) { yield(:up, x); super() }
+ define_method(:down) { yield(:down, x); super() }
}) if block_given?
end
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index 366c72ebaa..4757c79ac6 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -84,10 +84,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?