Skip to content
Browse files

Used Yield instead of block.call

  • Loading branch information...
1 parent 140c0c8 commit d3a1ce1cdc60d593de1682c5f4e3230c8db9a0fd @kuldeepaggarwal kuldeepaggarwal committed Nov 15, 2013
View
4 actionpack/lib/action_controller/metal/mime_responds.rb
@@ -358,10 +358,10 @@ def collect_mimes_from_class_level #: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
View
4 actionview/lib/action_view/helpers/atom_feed_helper.rb
@@ -135,11 +135,11 @@ def initialize(xml)
# 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
View
6 activerecord/test/cases/migrator_test.rb
@@ -346,11 +346,11 @@ def test_get_all_versions
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() }
@jeremy
Ruby on Rails member
jeremy added a note Nov 14, 2013

This is probably what broke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
}) if block_given?
end
View
4 railties/lib/rails/generators/actions.rb
@@ -84,10 +84,10 @@ def add_source(source, options={})
# 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?

2 comments on commit d3a1ce1

@dhh
Ruby on Rails member
dhh commented on d3a1ce1 Nov 14, 2013

I have reverted this commit. It caused all of atom_helper_test.rb to fail with "SystemStackError: stack level too deep"

@rafaelfranca
Ruby on Rails member

👍 Thanks

Please sign in to comment.
Something went wrong with that request. Please try again.