1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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 d3a1ce1cdc.
This commit is contained in:
David Heinemeier Hansson 2013-11-14 15:31:27 -08:00
parent 421c81bd18
commit 07996ebc50
4 changed files with 9 additions and 9 deletions

View file

@ -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) #:nodoc:
def retrieve_collector_from_mimes(mimes=nil, &block) #:nodoc:
mimes ||= collect_mimes_from_class_level
collector = Collector.new(mimes)
yield(collector) if block_given?
block.call(collector) if block_given?
format = collector.negotiate_format(request)
if format

View file

@ -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)
def method_missing(method, *arguments, &block)
if xhtml_block?(method, arguments)
@xml.__send__(method, *arguments) do
@xml.div(:xmlns => 'http://www.w3.org/1999/xhtml') do |xhtml|
yield(xhtml)
block.call(xhtml)
end
end
else

View file

@ -346,11 +346,11 @@ module ActiveRecord
end
private
def m(name, version)
def m(name, version, &block)
x = Sensor.new name, version
x.extend(Module.new {
define_method(:up) { yield(:up, x); super() }
define_method(:down) { yield(:down, x); super() }
define_method(:up) { block.call(:up, x); super() }
define_method(:down) { block.call(:down, x); super() }
}) if block_given?
end

View file

@ -84,10 +84,10 @@ module Rails
# environment(nil, env: "development") do
# "config.autoload_paths += %W(#{config.root}/extras)"
# end
def environment(data = nil, options = {})
def environment(data=nil, options={}, &block)
sentinel = /class [a-z_:]+ < Rails::Application/i
env_file_sentinel = /Rails\.application\.configure do/
data = yield if !data && block_given?
data = block.call if !data && block_given?
in_root do
if options[:env].nil?