cuba 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -0
- data/README.md +1 -1
- data/cuba.gemspec +1 -1
- data/lib/cuba.rb +2 -3
- data/test/redirect.rb +1 -3
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 51a2e9df839f23563e53c9a4a7bc93657b55a781
|
|
4
|
+
data.tar.gz: 43432f0a85b2133cc1b052dd2f8ac4bf88eea0a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a8e53ef5c9a833d709bd095138aeb9b57be355d3758428c396e864a4b81d381615594a0c33977cdd960b727588178ba1ef8d2e87bec379ca84054abcd1d7f173
|
|
7
|
+
data.tar.gz: aa4fb0f2247bb8568fba9b38374a423ddee945972fe4143d97d5f488bdad2a08832c2581bbdc51d8c3726446cf5daf4f9a715215df713c911f44629e05d39e46
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
|
@@ -481,7 +481,7 @@ require "erb"
|
|
|
481
481
|
Cuba.plugin(Cuba::Render)
|
|
482
482
|
```
|
|
483
483
|
|
|
484
|
-
This example
|
|
484
|
+
This example uses ERB, a template engine that comes with Ruby. If you want to
|
|
485
485
|
use another template engine, one [supported by Tilt][templates], you need to
|
|
486
486
|
install the required gem and change the `template_engine` setting as shown
|
|
487
487
|
below.
|
data/cuba.gemspec
CHANGED
data/lib/cuba.rb
CHANGED
|
@@ -8,9 +8,7 @@ class Cuba
|
|
|
8
8
|
attr :body
|
|
9
9
|
attr :headers
|
|
10
10
|
|
|
11
|
-
def initialize(status = nil,
|
|
12
|
-
headers = { "Content-Type" => "text/html; charset=utf-8" })
|
|
13
|
-
|
|
11
|
+
def initialize(status = nil, headers = {})
|
|
14
12
|
@status = status
|
|
15
13
|
@headers = headers
|
|
16
14
|
@body = []
|
|
@@ -185,6 +183,7 @@ class Cuba
|
|
|
185
183
|
if res.body.empty?
|
|
186
184
|
res.status = 404
|
|
187
185
|
else
|
|
186
|
+
res.headers["Content-Type"] ||= "text/html; charset=utf-8"
|
|
188
187
|
res.status = 200
|
|
189
188
|
end
|
|
190
189
|
end
|
data/test/redirect.rb
CHANGED
|
@@ -16,8 +16,6 @@ test "redirect" do
|
|
|
16
16
|
status, headers, body = Cuba.call(env)
|
|
17
17
|
|
|
18
18
|
assert_equal status, 302
|
|
19
|
-
assert_equal headers, {
|
|
20
|
-
"Content-Type" => "text/html; charset=utf-8",
|
|
21
|
-
"Location" => "/hello" }
|
|
19
|
+
assert_equal headers, { "Location" => "/hello" }
|
|
22
20
|
assert_response body, []
|
|
23
21
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cuba
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michel Martens
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-08-
|
|
11
|
+
date: 2014-08-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|