write_xlsx_rails 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -1
- data/lib/write_xlsx_rails/template_handler.rb +4 -2
- data/lib/write_xlsx_rails/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -90,9 +90,11 @@ User.to_xlsx package: xlsx_package, (other options)
|
|
90
90
|
Partials work as expected:
|
91
91
|
|
92
92
|
```ruby
|
93
|
-
render partial: 'header', locals: {
|
93
|
+
render partial: 'header', locals: { workbook: workbook }
|
94
94
|
```
|
95
95
|
|
96
|
+
> NOTE: Every partial instantiate own _workbook_ variable. So, it can cause problems. To prevent this just pass workbook as local variable to the partial.
|
97
|
+
|
96
98
|
##Dependencies
|
97
99
|
|
98
100
|
* [write\_xlsx](http://github.com/cxn03651/write_xlsx)
|
@@ -12,11 +12,13 @@ module WriteXlsxRails
|
|
12
12
|
require 'stringio'
|
13
13
|
|
14
14
|
__io = StringIO.new
|
15
|
-
|
15
|
+
|
16
|
+
__workbook_defined = defined? workbook
|
17
|
+
workbook = WriteXLSX.new(__io) unless __workbook_defined
|
16
18
|
|
17
19
|
#{template.source}
|
18
20
|
|
19
|
-
workbook.close
|
21
|
+
workbook.close unless __workbook_defined
|
20
22
|
|
21
23
|
__io.flush
|
22
24
|
__io.string
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: write_xlsx_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: write_xlsx
|