Skip to content
This repository
Browse code

Revert "Used Yield instead of block.call" -- this causes all of atom_…

…feed_helper_test.rb to fail with "SystemStackError: stack level too deep".

This reverts commit d3a1ce1.
  • Loading branch information...
commit 07996ebc50f5906dbecc481ac83ed2adefc9ec6e 1 parent 421c81b
David Heinemeier Hansson dhh authored
4 actionpack/lib/action_controller/metal/mime_responds.rb
@@ -358,10 +358,10 @@ def collect_mimes_from_class_level #:nodoc:
358 358 #
359 359 # Sends :not_acceptable to the client and returns nil if no suitable format
360 360 # is available.
361   - def retrieve_collector_from_mimes(mimes = nil) #:nodoc:
  361 + def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
362 362 mimes ||= collect_mimes_from_class_level
363 363 collector = Collector.new(mimes)
364   - yield(collector) if block_given?
  364 + block.call(collector) if block_given?
365 365 format = collector.negotiate_format(request)
366 366
367 367 if format
4 actionview/lib/action_view/helpers/atom_feed_helper.rb
@@ -135,11 +135,11 @@ def initialize(xml)
135 135 # Delegate to xml builder, first wrapping the element in a xhtml
136 136 # namespaced div element if the method and arguments indicate
137 137 # that an xhtml_block? is desired.
138   - def method_missing(method, *arguments)
  138 + def method_missing(method, *arguments, &block)
139 139 if xhtml_block?(method, arguments)
140 140 @xml.__send__(method, *arguments) do
141 141 @xml.div(:xmlns => 'http://www.w3.org/1999/xhtml') do |xhtml|
142   - yield(xhtml)
  142 + block.call(xhtml)
143 143 end
144 144 end
145 145 else
6 activerecord/test/cases/migrator_test.rb
@@ -346,11 +346,11 @@ def test_get_all_versions
346 346 end
347 347
348 348 private
349   - def m(name, version)
  349 + def m(name, version, &block)
350 350 x = Sensor.new name, version
351 351 x.extend(Module.new {
352   - define_method(:up) { yield(:up, x); super() }
353   - define_method(:down) { yield(:down, x); super() }
  352 + define_method(:up) { block.call(:up, x); super() }
  353 + define_method(:down) { block.call(:down, x); super() }
354 354 }) if block_given?
355 355 end
356 356
4 railties/lib/rails/generators/actions.rb
@@ -84,10 +84,10 @@ def add_source(source, options={})
84 84 # environment(nil, env: "development") do
85 85 # "config.autoload_paths += %W(#{config.root}/extras)"
86 86 # end
87   - def environment(data = nil, options = {})
  87 + def environment(data=nil, options={}, &block)
88 88 sentinel = /class [a-z_:]+ < Rails::Application/i
89 89 env_file_sentinel = /Rails\.application\.configure do/
90   - data = yield if !data && block_given?
  90 + data = block.call if !data && block_given?
91 91
92 92 in_root do
93 93 if options[:env].nil?

0 comments on commit 07996eb

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