cabalist 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .yardoc
data/LICENSE CHANGED
@@ -0,0 +1,7 @@
1
+ Copyright (C) 2012 Marcin Wyszynski
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -105,8 +105,8 @@ So far we've used raw data, derived directly from attributes in your model. You
105
105
  ```ruby
106
106
  class Cat < ActiveRecord::Base
107
107
  # attributes: name, color, gender, good
108
- acts_as_cabalist( :features => [:light_or_dark, :gender],
109
- :class_variable => :good )
108
+ acts_as_cabalist :features => [:light_or_dark, :gender],
109
+ :class_variable => :good
110
110
 
111
111
  def light_or_dark
112
112
  if %w(white yellow orange grey).include?(color)
data/doc/Cabalist.html ADDED
@@ -0,0 +1,257 @@
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
+ Module: Cabalist
8
+
9
+ &mdash; Documentation by YARD 0.7.2
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">Index (C)</a> &raquo;
37
+
38
+
39
+ <span class="title">Cabalist</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Module: Cabalist
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+ <dt class="r1 last">Defined in:</dt>
75
+ <dd class="r1 last">lib/cabalist.rb<span class="defines">,<br />
76
+ lib/cabalist/version.rb,<br /> lib/cabalist/railtie.rb,<br /> lib/cabalist/frontend.rb,<br /> lib/cabalist/configuration.rb,<br /> lib/cabalist/model_additions.rb</span>
77
+ </dd>
78
+
79
+ </dl>
80
+ <div class="clear"></div>
81
+
82
+ <h2>Overview</h2><div class="docstring">
83
+ <div class="discussion">
84
+ <p>
85
+ Minimum setup machine learning (classification) library for Ruby on Rails
86
+ applications.
87
+ </p>
88
+
89
+
90
+ </div>
91
+ </div>
92
+ <div class="tags">
93
+
94
+ </div><h2>Defined Under Namespace</h2>
95
+ <p class="children">
96
+
97
+
98
+ <strong class="modules">Modules:</strong> <span class='object_link'><a href="Cabalist/ModelAdditions.html" title="Cabalist::ModelAdditions (module)">ModelAdditions</a></span>
99
+
100
+
101
+
102
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="Cabalist/Configuration.html" title="Cabalist::Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="Cabalist/Frontend.html" title="Cabalist::Frontend (class)">Frontend</a></span>, <span class='object_link'><a href="Cabalist/Railtie.html" title="Cabalist::Railtie (class)">Railtie</a></span>
103
+
104
+
105
+ </p>
106
+
107
+ <h2>Constant Summary</h2>
108
+
109
+ <dl class="constants">
110
+
111
+ <dt id="VERSION-constant" class="">VERSION =
112
+ <div class="docstring">
113
+ <div class="discussion">
114
+ <p>
115
+ Version of the gem
116
+ </p>
117
+
118
+
119
+ </div>
120
+ </div>
121
+ <div class="tags">
122
+
123
+ </div>
124
+ </dt>
125
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.0.3</span><span class='tstring_end'>&quot;</span></span></pre></dd>
126
+
127
+ </dl>
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ <h2>
136
+ Class Method Summary
137
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
138
+ </h2>
139
+
140
+ <ul class="summary">
141
+
142
+ <li class="public ">
143
+ <span class="summary_signature">
144
+
145
+ <a href="#configure-class_method" title="configure (class method)">+ (Cabalist::Configuration) <strong>configure</strong> {|Cabalist::Configuration.instance| ... }</a>
146
+
147
+
148
+
149
+ </span>
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+ <span class="summary_desc"><div class='inline'><p>
159
+ Configure the application.
160
+ </p>
161
+ </div></span>
162
+
163
+ </li>
164
+
165
+
166
+ </ul>
167
+
168
+
169
+
170
+
171
+ <div id="class_method_details" class="method_details_list">
172
+ <h2>Class Method Details</h2>
173
+
174
+
175
+ <div class="method_details first">
176
+ <p class="signature first" id="configure-class_method">
177
+
178
+ + (<tt><span class='object_link'><a href="Cabalist/Configuration.html" title="Cabalist::Configuration (class)">Cabalist::Configuration</a></span></tt>) <strong>configure</strong> {|Cabalist::Configuration.instance| ... }
179
+
180
+
181
+
182
+ </p><div class="docstring">
183
+ <div class="discussion">
184
+ <p>
185
+ Configure the application
186
+ </p>
187
+
188
+
189
+ </div>
190
+ </div>
191
+ <div class="tags">
192
+ <h3>Yields:</h3>
193
+ <ul class="yield">
194
+
195
+ <li>
196
+
197
+
198
+ <span class='type'>(<tt><span class='object_link'><a href="Cabalist/Configuration.html" title="Cabalist::Configuration (class)">Cabalist::Configuration</a></span>.instance</tt>)</span>
199
+
200
+
201
+
202
+ </li>
203
+
204
+ </ul>
205
+ <h3>Returns:</h3>
206
+ <ul class="return">
207
+
208
+ <li>
209
+
210
+
211
+ <span class='type'>(<tt><span class='object_link'><a href="Cabalist/Configuration.html" title="Cabalist::Configuration (class)">Cabalist::Configuration</a></span></tt>)</span>
212
+
213
+
214
+
215
+ &mdash;
216
+ <div class='inline'><p>
217
+ library configuration singleton
218
+ </p>
219
+ </div>
220
+
221
+ </li>
222
+
223
+ </ul>
224
+
225
+ </div><table class="source_code">
226
+ <tr>
227
+ <td>
228
+ <pre class="lines">
229
+
230
+
231
+ 14
232
+ 15
233
+ 16</pre>
234
+ </td>
235
+ <td>
236
+ <pre class="code"><span class="info file"># File 'lib/cabalist.rb', line 14</span>
237
+
238
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id configure'>configure</span>
239
+ <span class='kw'>yield</span> <span class='const'>Cabalist</span><span class='op'>::</span><span class='const'>Configuration</span><span class='period'>.</span><span class='id instance'>instance</span>
240
+ <span class='kw'>end</span></pre>
241
+ </td>
242
+ </tr>
243
+ </table>
244
+ </div>
245
+
246
+ </div>
247
+
248
+ </div>
249
+
250
+ <div id="footer">
251
+ Generated on Wed Apr 25 18:24:45 2012 by
252
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
253
+ 0.7.2 (ruby-1.9.2).
254
+ </div>
255
+
256
+ </body>
257
+ </html>
@@ -0,0 +1,320 @@
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
+ Class: Cabalist::ClassifierGenerator
8
+
9
+ &mdash; Documentation by YARD 0.7.2
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">Index (C)</a> &raquo;
37
+ <span class='title'><span class='object_link'><a href="../Cabalist.html" title="Cabalist (module)">Cabalist</a></span></span>
38
+ &raquo;
39
+ <span class="title">ClassifierGenerator</span>
40
+
41
+
42
+ <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
+ </div>
44
+
45
+ <div id="search">
46
+
47
+ <a id="class_list_link" href="#">Class List</a>
48
+
49
+ <a id="method_list_link" href="#">Method List</a>
50
+
51
+ <a id="file_list_link" href="#">File List</a>
52
+
53
+ </div>
54
+ <div class="clear"></div>
55
+ </div>
56
+
57
+ <iframe id="search_frame"></iframe>
58
+
59
+ <div id="content"><h1>Class: Cabalist::ClassifierGenerator
60
+
61
+
62
+
63
+ </h1>
64
+
65
+ <dl class="box">
66
+
67
+ <dt class="r1">Inherits:</dt>
68
+ <dd class="r1">
69
+ <span class="inheritName">Rails::Generators::NamedBase</span>
70
+
71
+ <ul class="fullTree">
72
+ <li>Object</li>
73
+
74
+ <li class="next">Rails::Generators::NamedBase</li>
75
+
76
+ <li class="next">Cabalist::ClassifierGenerator</li>
77
+
78
+ </ul>
79
+ <a href="#" class="inheritanceTree">show all</a>
80
+
81
+ </dd>
82
+
83
+
84
+
85
+
86
+
87
+
88
+ <dt class="r2">Includes:</dt>
89
+ <dd class="r2">Rails::Generators::Migration</dd>
90
+
91
+
92
+
93
+
94
+
95
+ <dt class="r1 last">Defined in:</dt>
96
+ <dd class="r1 last">lib/generators/cabalist/classifier/classifier_generator.rb</dd>
97
+
98
+ </dl>
99
+ <div class="clear"></div>
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+ <h2>
112
+ Class Method Summary
113
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
114
+ </h2>
115
+
116
+ <ul class="summary">
117
+
118
+ <li class="public ">
119
+ <span class="summary_signature">
120
+
121
+ <a href="#next_migration_number-class_method" title="next_migration_number (class method)">+ (Object) <strong>next_migration_number</strong>(dirname) </a>
122
+
123
+
124
+
125
+ </span>
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+ <span class="summary_desc"><div class='inline'></div></span>
135
+
136
+ </li>
137
+
138
+
139
+ </ul>
140
+
141
+ <h2>
142
+ Instance Method Summary
143
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
144
+ </h2>
145
+
146
+ <ul class="summary">
147
+
148
+ <li class="public ">
149
+ <span class="summary_signature">
150
+
151
+ <a href="#add_to_gui_if_necessary-instance_method" title="#add_to_gui_if_necessary (instance method)">- (Object) <strong>add_to_gui_if_necessary</strong> </a>
152
+
153
+
154
+
155
+ </span>
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+ <span class="summary_desc"><div class='inline'></div></span>
165
+
166
+ </li>
167
+
168
+
169
+ <li class="public ">
170
+ <span class="summary_signature">
171
+
172
+ <a href="#create_migration-instance_method" title="#create_migration (instance method)">- (Object) <strong>create_migration</strong> </a>
173
+
174
+
175
+
176
+ </span>
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+ <span class="summary_desc"><div class='inline'></div></span>
186
+
187
+ </li>
188
+
189
+
190
+ </ul>
191
+
192
+
193
+
194
+
195
+
196
+
197
+ <div id="class_method_details" class="method_details_list">
198
+ <h2>Class Method Details</h2>
199
+
200
+
201
+ <div class="method_details first">
202
+ <p class="signature first" id="next_migration_number-class_method">
203
+
204
+ + (<tt>Object</tt>) <strong>next_migration_number</strong>(dirname)
205
+
206
+
207
+
208
+ </p><table class="source_code">
209
+ <tr>
210
+ <td>
211
+ <pre class="lines">
212
+
213
+
214
+ 15
215
+ 16
216
+ 17</pre>
217
+ </td>
218
+ <td>
219
+ <pre class="code"><span class="info file"># File 'lib/generators/cabalist/classifier/classifier_generator.rb', line 15</span>
220
+
221
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id next_migration_number'>next_migration_number</span><span class='lparen'>(</span><span class='id dirname'>dirname</span><span class='rparen'>)</span>
222
+ <span class='const'>Time</span><span class='period'>.</span><span class='id now'>now</span><span class='period'>.</span><span class='id strftime'>strftime</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>%Y%m%d%H%M%S</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
223
+ <span class='kw'>end</span></pre>
224
+ </td>
225
+ </tr>
226
+ </table>
227
+ </div>
228
+
229
+ </div>
230
+
231
+ <div id="instance_method_details" class="method_details_list">
232
+ <h2>Instance Method Details</h2>
233
+
234
+
235
+ <div class="method_details first">
236
+ <p class="signature first" id="add_to_gui_if_necessary-instance_method">
237
+
238
+ - (<tt>Object</tt>) <strong>add_to_gui_if_necessary</strong>
239
+
240
+
241
+
242
+ </p><table class="source_code">
243
+ <tr>
244
+ <td>
245
+ <pre class="lines">
246
+
247
+
248
+ 24
249
+ 25
250
+ 26
251
+ 27
252
+ 28
253
+ 29
254
+ 30
255
+ 31
256
+ 32
257
+ 33
258
+ 34</pre>
259
+ </td>
260
+ <td>
261
+ <pre class="code"><span class="info file"># File 'lib/generators/cabalist/classifier/classifier_generator.rb', line 24</span>
262
+
263
+ <span class='kw'>def</span> <span class='id add_to_gui_if_necessary'>add_to_gui_if_necessary</span>
264
+ <span class='id add_to_gui'>add_to_gui</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span>
265
+ <span class='kw'>until</span> <span class='qwords_beg'>%w(</span><span class='tstring_content'>y</span><span class='words_sep'> </span><span class='tstring_content'>Y</span><span class='words_sep'> </span><span class='tstring_content'>n</span><span class='words_sep'> </span><span class='tstring_content'>N</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id add_to_gui'>add_to_gui</span><span class='rparen'>)</span>
266
+ <span class='id add_to_gui'>add_to_gui</span> <span class='op'>=</span> <span class='id ask'>ask</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Would you like to have access to this model through GUI dashboard? (Y/n) </span><span class='tstring_end'>&quot;</span></span>
267
+ <span class='kw'>end</span>
268
+ <span class='kw'>if</span> <span class='qwords_beg'>%w(</span><span class='tstring_content'>Y</span><span class='words_sep'> </span><span class='tstring_content'>y</span><span class='words_sep'>)</span><span class='period'>.</span><span class='id include?'>include?</span><span class='lparen'>(</span><span class='id add_to_gui'>add_to_gui</span><span class='rparen'>)</span>
269
+ <span class='id inject_into_file'>inject_into_file</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>config/initializers/cabalist.rb</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
270
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\n c.frontend_classes &lt;&lt; </span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
271
+ <span class='symbol'>:before</span> <span class='op'>=&gt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>\nend</span><span class='tstring_end'>&quot;</span></span>
272
+ <span class='kw'>end</span>
273
+ <span class='kw'>end</span></pre>
274
+ </td>
275
+ </tr>
276
+ </table>
277
+ </div>
278
+
279
+ <div class="method_details ">
280
+ <p class="signature " id="create_migration-instance_method">
281
+
282
+ - (<tt>Object</tt>) <strong>create_migration</strong>
283
+
284
+
285
+
286
+ </p><table class="source_code">
287
+ <tr>
288
+ <td>
289
+ <pre class="lines">
290
+
291
+
292
+ 19
293
+ 20
294
+ 21
295
+ 22</pre>
296
+ </td>
297
+ <td>
298
+ <pre class="code"><span class="info file"># File 'lib/generators/cabalist/classifier/classifier_generator.rb', line 19</span>
299
+
300
+ <span class='kw'>def</span> <span class='id create_migration'>create_migration</span>
301
+ <span class='id migration_template'>migration_template</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>migrations/add_cabalist.rb.erb</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span>
302
+ <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>db/migrate/add_cabalist_to_</span><span class='embexpr_beg'>#{</span><span class='id name'>name</span><span class='period'>.</span><span class='id tableize'>tableize</span><span class='rbrace'>}</span><span class='tstring_content'>.rb</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
303
+ <span class='kw'>end</span></pre>
304
+ </td>
305
+ </tr>
306
+ </table>
307
+ </div>
308
+
309
+ </div>
310
+
311
+ </div>
312
+
313
+ <div id="footer">
314
+ Generated on Wed Apr 25 00:10:24 2012 by
315
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
316
+ 0.7.2 (ruby-1.9.2).
317
+ </div>
318
+
319
+ </body>
320
+ </html>