提交 408bbdcd 编写于 作者: J José Valim

Merge pull request #1267 from guilleiguaran/prefer-each-syntax

Prefer 'each' syntax instead of 'for in'
......@@ -55,7 +55,7 @@ def initialize(responses)
@responses = responses
end
for method in [ :post, :put, :get, :delete, :head ]
[ :post, :put, :get, :delete, :head ].each do |method|
# def post(path, request_headers = {}, body = nil, status = 200, response_headers = {})
# @responses[Request.new(:post, path, nil, request_headers)] = Response.new(body || "", status, response_headers)
# end
......
......@@ -77,7 +77,7 @@ def add(severity, message = nil, progname = nil, &block)
# def info
# def warn
# def debug
for severity in Severity.constants
Severity.constants.each do |severity|
class_eval <<-EOT, __FILE__, __LINE__ + 1
def #{severity.downcase}(message = nil, progname = nil, &block) # def debug(message = nil, progname = nil, &block)
add(#{severity}, message, progname, &block) # add(DEBUG, message, progname, &block)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册