acts_as_xlsx 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +0 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +32 -0
- data/LICENSE +22 -0
- data/README.md +95 -0
- data/Rakefile +18 -0
- data/acts_as_xlsx.gemspec +38 -0
- data/doc/Axlsx.html +124 -0
- data/doc/Axlsx/Ar.html +199 -0
- data/doc/Axlsx/Ar/ClassMethods.html +259 -0
- data/doc/Axlsx/Ar/InstanceMethods.html +188 -0
- data/doc/Axlsx/Ar/SingletonMethods.html +348 -0
- data/doc/_index.html +146 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.LICENSE.html +86 -0
- data/doc/file.README.html +166 -0
- data/doc/file_list.html +52 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +166 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +167 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +70 -0
- data/doc/top-level-namespace.html +103 -0
- data/lib/axlsx/acts_as_xlsx.rb +87 -0
- data/test/acts_as_xlsx.sqlite3.db +0 -0
- data/test/database.yml +3 -0
- data/test/helper.rb +72 -0
- data/test/tc_acts_as_xlsx.rb +49 -0
- metadata +157 -0
@@ -0,0 +1,86 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: LICENSE
|
8
|
+
|
9
|
+
— Acts As Xlsx (Axlsx)
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="_index.html" title="Index">Index</a> »
|
37
|
+
<span class="title">File: LICENSE</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a id="class_list_link" href="#">Class List</a>
|
46
|
+
|
47
|
+
<a id="method_list_link" href="#">Method List</a>
|
48
|
+
|
49
|
+
<a id="file_list_link" href="#">File List</a>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
<div class="clear"></div>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<iframe id="search_frame"></iframe>
|
56
|
+
|
57
|
+
<div id="content"><div id='filecontents'>
|
58
|
+
<p>Copyright © 2011 Randy Morgan</p>
|
59
|
+
|
60
|
+
<p>Permission is hereby granted, free of charge, to any person obtaining a
|
61
|
+
copy of this software and associated documentation files (the “Software”),
|
62
|
+
to deal in the Software without restriction, including without limitation
|
63
|
+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
64
|
+
and/or sell copies of the Software, and to permit persons to whom the
|
65
|
+
Software is furnished to do so, subject to the following conditions:</p>
|
66
|
+
|
67
|
+
<p>The above copyright notice and this permission notice shall be included in
|
68
|
+
all copies or substantial portions of the Software.</p>
|
69
|
+
|
70
|
+
<p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
71
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
72
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
73
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
74
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
75
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
76
|
+
DEALINGS IN THE SOFTWARE.</p>
|
77
|
+
</div></div>
|
78
|
+
|
79
|
+
<div id="footer">
|
80
|
+
Generated on Thu Dec 1 00:04:39 2011 by
|
81
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
82
|
+
0.7.3 (ruby-1.9.3).
|
83
|
+
</div>
|
84
|
+
|
85
|
+
</body>
|
86
|
+
</html>
|
@@ -0,0 +1,166 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Acts As Xlsx (Axlsx)
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="_index.html" title="Index">Index</a> »
|
37
|
+
<span class="title">File: README</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a id="class_list_link" href="#">Class List</a>
|
46
|
+
|
47
|
+
<a id="method_list_link" href="#">Method List</a>
|
48
|
+
|
49
|
+
<a id="file_list_link" href="#">File List</a>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
<div class="clear"></div>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<iframe id="search_frame"></iframe>
|
56
|
+
|
57
|
+
<div id="content"><div id='filecontents'><h1>Acts as xlsx: Office Open XML Spreadsheet Generation plugin for active record</h1>
|
58
|
+
|
59
|
+
<p><a href="http://travis-ci.org/randym/acts_as_xlsx/"><img src="https://secure.travis-ci.org/randym/acts_as_xlsx.png" alt="Build Status" /></a></p>
|
60
|
+
|
61
|
+
<p><strong>IRC</strong>: <a href="irc://irc.freenode.net/axlsx">irc.freenode.net / #axlsx</a> <br/>
|
62
|
+
<strong>Git</strong>: <a href="http://github.com/randym/acts_as_xlsx">http://github.com/randym/acts_as_xlsx</a> <br/>
|
63
|
+
<strong>Author</strong>: Randy Morgan <br/>
|
64
|
+
<strong>Copyright</strong>: 2011 <br/>
|
65
|
+
<strong>License</strong>: MIT License <br/>
|
66
|
+
<strong>Latest Version</strong>: 1.0.0 <br/>
|
67
|
+
<strong>Ruby Version</strong>: 1.8.7 - 1.9.3<br/>
|
68
|
+
<strong>Release Date</strong>: November 30th 2011</p>
|
69
|
+
|
70
|
+
<h2>Synopsis</h2>
|
71
|
+
|
72
|
+
<p>Acts_as_xlsx is an active record plugin for Axlsx. It makes generating excel spreadsheets from any subclass of ActiveRecord::Base as simple as a couple of lines of code.</p>
|
73
|
+
|
74
|
+
<h2>Feature List</h2>
|
75
|
+
|
76
|
+
<p>**1. Mixes into active record base to provide to_xlsx methods on both class and instance active record inheritors.</p>
|
77
|
+
|
78
|
+
<p>**2. Can work at the end of any series of finder methods.</p>
|
79
|
+
|
80
|
+
<p>**3. Can accept any set of find options</p>
|
81
|
+
|
82
|
+
<p>**4. Automates localization of column heading with i18n support</p>
|
83
|
+
|
84
|
+
<p>**5. Lets you specify columns to exclude from the report.</p>
|
85
|
+
|
86
|
+
<p>**6. Gives you access to the axlsx package so you can add styles, charts and pictures to satisfy those flashy sales guys.</p>
|
87
|
+
|
88
|
+
<p>**7. Plays nicely with both ruby 1.8.7 + rails 2.3 as well as ruby 1.9.3 + rails 3</p>
|
89
|
+
|
90
|
+
<h2>Installing</h2>
|
91
|
+
|
92
|
+
<p>To install, use the following command:</p>
|
93
|
+
|
94
|
+
<pre class="code">$ gem install acts_as_xlsx
|
95
|
+
</pre>
|
96
|
+
|
97
|
+
<h2>Usage</h2>
|
98
|
+
|
99
|
+
<h3>Examples</h3>
|
100
|
+
|
101
|
+
<p>A trivial rails example</p>
|
102
|
+
|
103
|
+
<pre class="code"> <span class='comment'>#Add the gem to your Gemfile and bundle install
|
104
|
+
</span> <span class='id gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>acts_as_xlsx</span><span class='tstring_end'>'</span></span>
|
105
|
+
|
106
|
+
<span class='comment'># app/models/post.rb
|
107
|
+
</span> <span class='kw'>class</span> <span class='const'>Post</span> <span class='op'><</span> <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>Base</span>
|
108
|
+
<span class='id acts_as_xlsx'>acts_as_xlsx</span>
|
109
|
+
<span class='kw'>end</span>
|
110
|
+
|
111
|
+
<span class='comment'># app/controllers/posts_controller.rb
|
112
|
+
</span> <span class='kw'>class</span> <span class='const'>PostsController</span> <span class='op'><</span> <span class='const'>ApplicationController</span>
|
113
|
+
<span class='comment'># GET posts/xlsx
|
114
|
+
</span> <span class='kw'>def</span> <span class='id xlsx'>xlsx</span>
|
115
|
+
<span class='id p'>p</span> <span class='op'>=</span> <span class='const'>Post</span><span class='period'>.</span><span class='id to_xlsx'>to_xlsx</span>
|
116
|
+
<span class='id p'>p</span><span class='period'>.</span><span class='id serialize'>serialize</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>public/downloads/posts.xlsx</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
117
|
+
<span class='id send_file'>send_file</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>public/downloads/posts.xlsx</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:type</span><span class='op'>=></span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>application/xlsx</span><span class='tstring_end'>"</span></span>
|
118
|
+
<span class='kw'>end</span>
|
119
|
+
<span class='kw'>end</span>
|
120
|
+
</pre>
|
121
|
+
|
122
|
+
<p>Specify columns and methods and i18n chain</p>
|
123
|
+
|
124
|
+
<pre class="code"><span class='id p'>p</span> <span class='op'>=</span> <span class='const'>Post</span><span class='period'>.</span><span class='id to_xlsx'>to_xlsx</span> <span class='symbol'>:columns</span> <span class='op'>=></span> <span class='lbracket'>[</span><span class='symbol'>:name</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:ranking</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:i18n</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>activerecord.attributes</span><span class='tstring_end'>'</span></span>
|
125
|
+
</pre>
|
126
|
+
|
127
|
+
<h3>Documentation</h3>
|
128
|
+
|
129
|
+
<p>This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use:</p>
|
130
|
+
|
131
|
+
<pre class="code"> <span class='id gem'>gem</span> <span class='id install'>install</span> <span class='id yard'>yard</span>
|
132
|
+
<span class='id yard'>yard</span> <span class='id server'>server</span> <span class='op'>-</span><span class='id g'>g</span>
|
133
|
+
</pre>
|
134
|
+
|
135
|
+
<h3>Specs</h3>
|
136
|
+
|
137
|
+
<p>This gem has 100% coverage using Test::Unit</p>
|
138
|
+
|
139
|
+
<h2>Changelog</h2>
|
140
|
+
|
141
|
+
<ul>
|
142
|
+
<li><strong>October.30.11</strong>: 1.0.0a release
|
143
|
+
|
144
|
+
<ul>
|
145
|
+
<li>First pre release</li>
|
146
|
+
</ul>
|
147
|
+
</li>
|
148
|
+
</ul>
|
149
|
+
|
150
|
+
|
151
|
+
<p>Please see the <a href="file.CHANGELOG.html" title="CHANGELOG">CHANGELOG</a> document for past release information.</p>
|
152
|
+
|
153
|
+
<h2>Copyright</h2>
|
154
|
+
|
155
|
+
<p>Acts_as_xlsx © 2011 by <a href="mailto:digial.ipseity@gmail.com">Randy Morgan</a>. Acts_as_xlsx is
|
156
|
+
licensed under the MIT license. Please see the <a href="file.LICENSE.html" title="LICENSE">LICENSE</a> document for more information.</p>
|
157
|
+
</div></div>
|
158
|
+
|
159
|
+
<div id="footer">
|
160
|
+
Generated on Thu Dec 1 00:04:39 2011 by
|
161
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
162
|
+
0.7.3 (ruby-1.9.3).
|
163
|
+
</div>
|
164
|
+
|
165
|
+
</body>
|
166
|
+
</html>
|
data/doc/file_list.html
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<base id="base_target" target="_parent" />
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<script type="text/javascript" charset="utf-8">
|
22
|
+
if (window.top.frames.main) {
|
23
|
+
document.getElementById('base_target').target = 'main';
|
24
|
+
document.body.className = 'frames';
|
25
|
+
}
|
26
|
+
</script>
|
27
|
+
<div id="content">
|
28
|
+
<h1 id="full_list_header">File List</h1>
|
29
|
+
<div id="nav">
|
30
|
+
|
31
|
+
<a target="_self" href="class_list.html">Classes</a>
|
32
|
+
|
33
|
+
<a target="_self" href="method_list.html">Methods</a>
|
34
|
+
|
35
|
+
<a target="_self" href="file_list.html">Files</a>
|
36
|
+
|
37
|
+
</div>
|
38
|
+
<div id="search">Search: <input type="text" /></div>
|
39
|
+
|
40
|
+
<ul id="full_list" class="files">
|
41
|
+
|
42
|
+
|
43
|
+
<li class="r1"><a href="index.html" title="README">README</a></li>
|
44
|
+
|
45
|
+
|
46
|
+
<li class="r2"><a href="file.LICENSE.html" title="LICENSE">LICENSE</a></li>
|
47
|
+
|
48
|
+
|
49
|
+
</ul>
|
50
|
+
</div>
|
51
|
+
</body>
|
52
|
+
</html>
|
data/doc/frames.html
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
3
|
+
|
4
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
+
<head>
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
+
<title>Acts As Xlsx (Axlsx)</title>
|
8
|
+
</head>
|
9
|
+
<frameset cols="20%,*">
|
10
|
+
<frame name="list" src="class_list.html" />
|
11
|
+
<frame name="main" src="index.html" />
|
12
|
+
</frameset>
|
13
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Acts As Xlsx (Axlsx)
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="_index.html" title="Index">Index</a> »
|
37
|
+
<span class="title">File: README</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a id="class_list_link" href="#">Class List</a>
|
46
|
+
|
47
|
+
<a id="method_list_link" href="#">Method List</a>
|
48
|
+
|
49
|
+
<a id="file_list_link" href="#">File List</a>
|
50
|
+
|
51
|
+
</div>
|
52
|
+
<div class="clear"></div>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<iframe id="search_frame"></iframe>
|
56
|
+
|
57
|
+
<div id="content"><div id='filecontents'><h1>Acts as xlsx: Office Open XML Spreadsheet Generation plugin for active record</h1>
|
58
|
+
|
59
|
+
<p><a href="http://travis-ci.org/randym/acts_as_xlsx/"><img src="https://secure.travis-ci.org/randym/acts_as_xlsx.png" alt="Build Status" /></a></p>
|
60
|
+
|
61
|
+
<p><strong>IRC</strong>: <a href="irc://irc.freenode.net/axlsx">irc.freenode.net / #axlsx</a> <br/>
|
62
|
+
<strong>Git</strong>: <a href="http://github.com/randym/acts_as_xlsx">http://github.com/randym/acts_as_xlsx</a> <br/>
|
63
|
+
<strong>Author</strong>: Randy Morgan <br/>
|
64
|
+
<strong>Copyright</strong>: 2011 <br/>
|
65
|
+
<strong>License</strong>: MIT License <br/>
|
66
|
+
<strong>Latest Version</strong>: 1.0.0 <br/>
|
67
|
+
<strong>Ruby Version</strong>: 1.8.7 - 1.9.3<br/>
|
68
|
+
<strong>Release Date</strong>: November 30th 2011</p>
|
69
|
+
|
70
|
+
<h2>Synopsis</h2>
|
71
|
+
|
72
|
+
<p>Acts_as_xlsx is an active record plugin for Axlsx. It makes generating excel spreadsheets from any subclass of ActiveRecord::Base as simple as a couple of lines of code.</p>
|
73
|
+
|
74
|
+
<h2>Feature List</h2>
|
75
|
+
|
76
|
+
<p>**1. Mixes into active record base to provide to_xlsx methods on both class and instance active record inheritors.</p>
|
77
|
+
|
78
|
+
<p>**2. Can work at the end of any series of finder methods.</p>
|
79
|
+
|
80
|
+
<p>**3. Can accept any set of find options</p>
|
81
|
+
|
82
|
+
<p>**4. Automates localization of column heading with i18n support</p>
|
83
|
+
|
84
|
+
<p>**5. Lets you specify columns to exclude from the report.</p>
|
85
|
+
|
86
|
+
<p>**6. Gives you access to the axlsx package so you can add styles, charts and pictures to satisfy those flashy sales guys.</p>
|
87
|
+
|
88
|
+
<p>**7. Plays nicely with both ruby 1.8.7 + rails 2.3 as well as ruby 1.9.3 + rails 3</p>
|
89
|
+
|
90
|
+
<h2>Installing</h2>
|
91
|
+
|
92
|
+
<p>To install, use the following command:</p>
|
93
|
+
|
94
|
+
<pre class="code">$ gem install acts_as_xlsx
|
95
|
+
</pre>
|
96
|
+
|
97
|
+
<h2>Usage</h2>
|
98
|
+
|
99
|
+
<h3>Examples</h3>
|
100
|
+
|
101
|
+
<p>A trivial rails example</p>
|
102
|
+
|
103
|
+
<pre class="code"> <span class='comment'>#Add the gem to your Gemfile and bundle install
|
104
|
+
</span> <span class='id gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>acts_as_xlsx</span><span class='tstring_end'>'</span></span>
|
105
|
+
|
106
|
+
<span class='comment'># app/models/post.rb
|
107
|
+
</span> <span class='kw'>class</span> <span class='const'>Post</span> <span class='op'><</span> <span class='const'>ActiveRecord</span><span class='op'>::</span><span class='const'>Base</span>
|
108
|
+
<span class='id acts_as_xlsx'>acts_as_xlsx</span>
|
109
|
+
<span class='kw'>end</span>
|
110
|
+
|
111
|
+
<span class='comment'># app/controllers/posts_controller.rb
|
112
|
+
</span> <span class='kw'>class</span> <span class='const'>PostsController</span> <span class='op'><</span> <span class='const'>ApplicationController</span>
|
113
|
+
<span class='comment'># GET posts/xlsx
|
114
|
+
</span> <span class='kw'>def</span> <span class='id xlsx'>xlsx</span>
|
115
|
+
<span class='id p'>p</span> <span class='op'>=</span> <span class='const'>Post</span><span class='period'>.</span><span class='id to_xlsx'>to_xlsx</span>
|
116
|
+
<span class='id p'>p</span><span class='period'>.</span><span class='id serialize'>serialize</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>public/downloads/posts.xlsx</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
117
|
+
<span class='id send_file'>send_file</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>public/downloads/posts.xlsx</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='symbol'>:type</span><span class='op'>=></span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>application/xlsx</span><span class='tstring_end'>"</span></span>
|
118
|
+
<span class='kw'>end</span>
|
119
|
+
<span class='kw'>end</span>
|
120
|
+
</pre>
|
121
|
+
|
122
|
+
<p>Specify columns and methods and i18n chain</p>
|
123
|
+
|
124
|
+
<pre class="code"><span class='id p'>p</span> <span class='op'>=</span> <span class='const'>Post</span><span class='period'>.</span><span class='id to_xlsx'>to_xlsx</span> <span class='symbol'>:columns</span> <span class='op'>=></span> <span class='lbracket'>[</span><span class='symbol'>:name</span><span class='comma'>,</span> <span class='symbol'>:title</span><span class='comma'>,</span> <span class='symbol'>:ranking</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='symbol'>:i18n</span> <span class='op'>=></span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>activerecord.attributes</span><span class='tstring_end'>'</span></span>
|
125
|
+
</pre>
|
126
|
+
|
127
|
+
<h3>Documentation</h3>
|
128
|
+
|
129
|
+
<p>This gem is 100% documented with YARD, an exceptional documentation library. To see documentation for this, and all the gems installed on your system use:</p>
|
130
|
+
|
131
|
+
<pre class="code"> <span class='id gem'>gem</span> <span class='id install'>install</span> <span class='id yard'>yard</span>
|
132
|
+
<span class='id yard'>yard</span> <span class='id server'>server</span> <span class='op'>-</span><span class='id g'>g</span>
|
133
|
+
</pre>
|
134
|
+
|
135
|
+
<h3>Specs</h3>
|
136
|
+
|
137
|
+
<p>This gem has 100% coverage using Test::Unit</p>
|
138
|
+
|
139
|
+
<h2>Changelog</h2>
|
140
|
+
|
141
|
+
<ul>
|
142
|
+
<li><strong>October.30.11</strong>: 1.0.0a release
|
143
|
+
|
144
|
+
<ul>
|
145
|
+
<li>First pre release</li>
|
146
|
+
</ul>
|
147
|
+
</li>
|
148
|
+
</ul>
|
149
|
+
|
150
|
+
|
151
|
+
<p>Please see the <a href="file.CHANGELOG.html" title="CHANGELOG">CHANGELOG</a> document for past release information.</p>
|
152
|
+
|
153
|
+
<h2>Copyright</h2>
|
154
|
+
|
155
|
+
<p>Acts_as_xlsx © 2011 by <a href="mailto:digial.ipseity@gmail.com">Randy Morgan</a>. Acts_as_xlsx is
|
156
|
+
licensed under the MIT license. Please see the <a href="file.LICENSE.html" title="LICENSE">LICENSE</a> document for more information.</p>
|
157
|
+
</div></div>
|
158
|
+
|
159
|
+
<div id="footer">
|
160
|
+
Generated on Thu Dec 1 00:04:39 2011 by
|
161
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
162
|
+
0.7.3 (ruby-1.9.3).
|
163
|
+
</div>
|
164
|
+
|
165
|
+
</body>
|
166
|
+
</html>
|