sinatra-writeexcel 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/README.md +1 -1
- data/lib/sinatra/writeexcel/version.rb +1 -1
- data/lib/sinatra/writeexcel.rb +1 -1
- data/spec/header_spec.rb +10 -0
- data/spec/mock/app.rb +4 -0
- 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: d15a140df906b6d82fa2b576aa11bb561bf75745
|
4
|
+
data.tar.gz: a973d6fd3d4462aab63f562be256d904d91b9200
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f87eec077ac5b2959e40a072a6b62c8da741a408d49375a7e0fef066f0fb50be1287d8645fbce51201a8e6b4b33f022d17dd017e20473e3884e5184e8d79354
|
7
|
+
data.tar.gz: 7f7e20a2d841255b11ab437cb76c3b6cb5a279e02f56ba875c60e0c7946bc28486ab156a813c34a8b0bf98ce768529807d0705c0815bd7aa7dd7459602acd806
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/lib/sinatra/writeexcel.rb
CHANGED
@@ -7,7 +7,7 @@ module Sinatra
|
|
7
7
|
def writeexcel(template = nil, options = {}, locals = {}, &block)
|
8
8
|
headers(
|
9
9
|
'Content-Type' => 'application/vnd.ms-excel',
|
10
|
-
'Content-Disposition' => "attachment; filename=#{template}.xls"
|
10
|
+
'Content-Disposition' => "attachment; filename=#{options[:filename] || template}.xls"
|
11
11
|
)
|
12
12
|
options, template = template, nil if template.is_a?(Hash)
|
13
13
|
template = -> { block } if template.nil?
|
data/spec/header_spec.rb
CHANGED
@@ -11,4 +11,14 @@ describe 'template header' do
|
|
11
11
|
get '/'
|
12
12
|
expect(last_response.header["Content-Type"]).to eq('application/vnd.ms-excel')
|
13
13
|
end
|
14
|
+
|
15
|
+
it "should return content disposition attachment; filename=..." do
|
16
|
+
get '/'
|
17
|
+
expect(last_response.header["Content-Disposition"]).to eq('attachment; filename=test.xls')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should able to set excel filename" do
|
21
|
+
get '/test_filename'
|
22
|
+
expect(last_response.header["Content-Disposition"]).to eq('attachment; filename=foobar.xls')
|
23
|
+
end
|
14
24
|
end
|
data/spec/mock/app.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-writeexcel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lincoln Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|