зеркало из https://github.com/github/ruby.git
20 строки
474 B
YAML
20 строки
474 B
YAML
prelude: |
|
|
def call(*val)
|
|
case val
|
|
in [String => body]
|
|
[200, {}, [body]]
|
|
in [Integer => status]
|
|
[status, {}, [""]]
|
|
in [Integer, String] => response
|
|
[response[0], {}, [response[1]]]
|
|
in [Integer, Hash, String] => response
|
|
[response[0], response[1], [response[2]]]
|
|
end
|
|
end
|
|
|
|
benchmark:
|
|
first_match: call("ok")
|
|
second_match: call(401)
|
|
third_match: call(200, "ok")
|
|
fourth_match: call(201, {}, "created")
|