sinatra 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sinatra might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/CHANGELOG.md +22 -0
- data/Gemfile +1 -0
- data/README.de.md +3 -3
- data/README.es.md +3 -3
- data/README.fr.md +3 -3
- data/README.ja.md +6 -5
- data/README.ko.md +3 -3
- data/README.malayalam.md +3141 -0
- data/README.md +7 -5
- data/README.pt-br.md +3 -3
- data/README.ru.md +3 -3
- data/README.zh.md +2 -2
- data/VERSION +1 -1
- data/lib/sinatra/base.rb +1 -1
- data/lib/sinatra/indifferent_hash.rb +3 -14
- data/lib/sinatra/version.rb +1 -1
- metadata +7 -5
data/README.md
CHANGED
@@ -351,13 +351,13 @@ But other values are also accepted.
|
|
351
351
|
You can return any object that would either be a valid Rack response, Rack
|
352
352
|
body object or HTTP status code:
|
353
353
|
|
354
|
-
* An Array with three elements: `[status (
|
354
|
+
* An Array with three elements: `[status (Integer), headers (Hash), response
|
355
355
|
body (responds to #each)]`
|
356
|
-
* An Array with two elements: `[status (
|
356
|
+
* An Array with two elements: `[status (Integer), response body (responds to
|
357
357
|
#each)]`
|
358
358
|
* An object that responds to `#each` and passes nothing but strings to
|
359
359
|
the given block
|
360
|
-
* A
|
360
|
+
* A Integer representing the status code
|
361
361
|
|
362
362
|
That way we can, for instance, easily implement a streaming example:
|
363
363
|
|
@@ -611,13 +611,15 @@ get('/') { markdown :index }
|
|
611
611
|
<tr>
|
612
612
|
<td>Dependency</td>
|
613
613
|
<td>
|
614
|
-
<a href="
|
614
|
+
<a href="https://github.com/jeremyevans/erubi" title="erubi">erubi</a>
|
615
|
+
or <a href="http://www.kuwata-lab.com/erubis/" title="erubis">erubis</a>
|
615
616
|
or erb (included in Ruby)
|
616
617
|
</td>
|
617
618
|
</tr>
|
618
619
|
<tr>
|
619
620
|
<td>File Extensions</td>
|
620
|
-
<td><tt>.erb</tt>, <tt>.rhtml</tt> or <tt>.
|
621
|
+
<td><tt>.erb</tt>, <tt>.rhtml</tt> or <tt>.erubi</tt> (Erubi only)
|
622
|
+
or <tt>.erubis</tt> (Erubis only)</td>
|
621
623
|
</tr>
|
622
624
|
<tr>
|
623
625
|
<td>Example</td>
|
data/README.pt-br.md
CHANGED
@@ -293,16 +293,16 @@ Você pode retornar uma resposta válida ou um objeto para o Rack, sendo
|
|
293
293
|
eles de qualquer tipo de objeto que queira. Além disso, é possível
|
294
294
|
retornar um código de status HTTP.
|
295
295
|
|
296
|
-
* Um array com três elementros: `[status (
|
296
|
+
* Um array com três elementros: `[status (Integer), cabecalho (Hash),
|
297
297
|
corpo da resposta (responde à #each)]`
|
298
298
|
|
299
|
-
* Um array com dois elementros: `[status (
|
299
|
+
* Um array com dois elementros: `[status (Integer), corpo da resposta
|
300
300
|
(responde à #each)]`
|
301
301
|
|
302
302
|
* Um objeto que responda à `#each` sem passar nada, mas, sim, `strings`
|
303
303
|
para um dado bloco
|
304
304
|
|
305
|
-
* Um objeto `
|
305
|
+
* Um objeto `Integer` representando o código de status
|
306
306
|
|
307
307
|
Dessa forma, podemos implementar facilmente um exemplo de streaming:
|
308
308
|
|
data/README.ru.md
CHANGED
@@ -353,13 +353,13 @@ end
|
|
353
353
|
Вы можете вернуть любой объект, который будет либо корректным Rack ответом,
|
354
354
|
либо объектом Rack body, либо кодом состояния HTTP:
|
355
355
|
|
356
|
-
* массив с тремя переменными: `[код (
|
356
|
+
* массив с тремя переменными: `[код (Integer), заголовки (Hash), тело ответа
|
357
357
|
(должно отвечать на #each)]`;
|
358
|
-
* массив с двумя переменными: `[код (
|
358
|
+
* массив с двумя переменными: `[код (Integer), тело ответа (должно отвечать
|
359
359
|
на #each)]`;
|
360
360
|
* объект, отвечающий на `#each`, который передает только строковые типы
|
361
361
|
данных в этот блок;
|
362
|
-
*
|
362
|
+
* Integer, представляющий код состояния HTTP.
|
363
363
|
|
364
364
|
Таким образом легко можно реализовать, например, потоковую передачу:
|
365
365
|
|
data/README.zh.md
CHANGED
@@ -324,8 +324,8 @@ Rack 堆栈中的下一个中间件。大多数情况下,返回值是一个字
|
|
324
324
|
|
325
325
|
你可以返回任何对象,该对象要么是一个合理的 Rack 响应,要么是一个 Rack body 对象,要么是 HTTP 状态码:
|
326
326
|
|
327
|
-
* 一个包含三个元素的数组: `[状态 (
|
328
|
-
* 一个包含两个元素的数组: `[状态 (
|
327
|
+
* 一个包含三个元素的数组: `[状态 (Integer), 响应首部 (Hash), 响应主体 (可以响应 #each 方法)]`
|
328
|
+
* 一个包含两个元素的数组: `[状态 (Integer), 响应主体 (可以响应 #each 方法)]`
|
329
329
|
* 一个响应 `#each` 方法,只传回字符串的对象
|
330
330
|
* 一个代表状态码的数字
|
331
331
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.5
|
data/lib/sinatra/base.rb
CHANGED
@@ -1089,7 +1089,7 @@ module Sinatra
|
|
1089
1089
|
|
1090
1090
|
# Dispatch a request with error handling.
|
1091
1091
|
def dispatch!
|
1092
|
-
|
1092
|
+
@params.merge!(@request.params).each { |key, val| @params[key] = force_encoding(val.dup) }
|
1093
1093
|
|
1094
1094
|
invoke do
|
1095
1095
|
static! if settings.static? && (request.get? || request.head?)
|
@@ -1,22 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
if !$LOAD_PATH.grep(%r{gems/activesupport}).empty? &&
|
3
|
-
puts <<-EOF
|
2
|
+
$stderr.puts <<EOF if !Hash.method_defined?(:slice) && !$LOAD_PATH.grep(%r{gems/activesupport}).empty? && ENV['SINATRA_ACTIVESUPPORT_WARNING'] != 'false'
|
4
3
|
WARNING: If you plan to load any of ActiveSupport's core extensions to Hash, be
|
5
4
|
sure to do so *before* loading Sinatra::Application or Sinatra::Base. If not,
|
6
5
|
you may disregard this warning.
|
7
|
-
EOF
|
8
|
-
end
|
9
6
|
|
10
|
-
|
11
|
-
|
12
|
-
# that we have no control over, but we need it to load *before*
|
13
|
-
# IndifferentHash, so we'll do it preemptively here.
|
14
|
-
#
|
15
|
-
# Newer Rubies have these methods built-in, so the extensions are no-ops.
|
16
|
-
require 'active_support/core_ext/hash/conversions'
|
17
|
-
require 'active_support/core_ext/hash/slice'
|
18
|
-
require 'active_support/core_ext/hash/keys'
|
19
|
-
end
|
7
|
+
Set SINATRA_ACTIVESUPPORT_WARNING=false in the environment to hide this warning.
|
8
|
+
EOF
|
20
9
|
|
21
10
|
module Sinatra
|
22
11
|
# A poor man's ActiveSupport::HashWithIndifferentAccess, with all the Rails-y
|
data/lib/sinatra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Mizerany
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2018-
|
14
|
+
date: 2018-12-22 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rack
|
@@ -47,14 +47,14 @@ dependencies:
|
|
47
47
|
requirements:
|
48
48
|
- - '='
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: 2.0.
|
50
|
+
version: 2.0.5
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
55
|
- - '='
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: 2.0.
|
57
|
+
version: 2.0.5
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: mustermann
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,6 +81,7 @@ extra_rdoc_files:
|
|
81
81
|
- README.hu.md
|
82
82
|
- README.ja.md
|
83
83
|
- README.ko.md
|
84
|
+
- README.malayalam.md
|
84
85
|
- README.md
|
85
86
|
- README.pt-br.md
|
86
87
|
- README.pt-pt.md
|
@@ -101,6 +102,7 @@ files:
|
|
101
102
|
- README.hu.md
|
102
103
|
- README.ja.md
|
103
104
|
- README.ko.md
|
105
|
+
- README.malayalam.md
|
104
106
|
- README.md
|
105
107
|
- README.pt-br.md
|
106
108
|
- README.pt-pt.md
|
@@ -154,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
156
|
version: '0'
|
155
157
|
requirements: []
|
156
158
|
rubyforge_project:
|
157
|
-
rubygems_version: 2.6
|
159
|
+
rubygems_version: 2.7.6
|
158
160
|
signing_key:
|
159
161
|
specification_version: 4
|
160
162
|
summary: Classy web-development dressed in a DSL
|