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

Used Yield instead of block.call

This commit is contained in:
Kuldeep Aggarwal 2013-11-15 00:53:57 +05:30
parent 140c0c8881
commit d3a1ce1cdc
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, &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 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, &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 file

@ -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

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={}, &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?