Dogeku 1.0.1

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.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/README.md +39 -0
  4. data/app/Historique/Action.rb +29 -0
  5. data/app/Historique/ChangerCase.rb +44 -0
  6. data/app/Historique/HistoriqueAction.rb +114 -0
  7. data/app/components/CaseDessin.rb +325 -0
  8. data/app/components/GrilleDessin.rb +235 -0
  9. data/app/components/Header.rb +194 -0
  10. data/app/config/app.yml +0 -0
  11. data/app/config/database.yml +2 -0
  12. data/app/controller/ApprentissageControleur.rb +75 -0
  13. data/app/controller/ChargerControleur.rb +41 -0
  14. data/app/controller/JeuLibreControleur.rb +244 -0
  15. data/app/controller/MenuControleur.rb +57 -0
  16. data/app/controller/NiveauControleur.rb +54 -0
  17. data/app/controller/NouvellePartieControleur.rb +34 -0
  18. data/app/controller/PrincipaleControleur.rb +30 -0
  19. data/app/controller/PseudoControleur.rb +95 -0
  20. data/app/controller/ReglagesControleur.rb +86 -0
  21. data/app/controller/ReglesControleur.rb +34 -0
  22. data/app/controller/ScoresControleur.rb +42 -0
  23. data/app/controller/StatistiquesControleur.rb +64 -0
  24. data/app/core/Conf.rb +26 -0
  25. data/app/core/Controller.rb +180 -0
  26. data/app/core/Core.rb +186 -0
  27. data/app/core/Model.rb +159 -0
  28. data/app/core/View.rb +56 -0
  29. data/app/db/main.sqlite3 +0 -0
  30. data/app/model/Configuration.rb +180 -0
  31. data/app/model/Grille.rb +180 -0
  32. data/app/model/Jeu.rb +74 -0
  33. data/app/model/Score.rb +100 -0
  34. data/app/model/Utilisateur.rb +113 -0
  35. data/app/utils/DSubset.rb +98 -0
  36. data/app/utils/Generateur.rb +171 -0
  37. data/app/utils/HPTriple.rb +75 -0
  38. data/app/utils/Peche.rb +46 -0
  39. data/app/utils/SCandidate.rb +86 -0
  40. data/app/utils/SCell.rb +73 -0
  41. data/app/utils/Technique.rb +202 -0
  42. data/app/utils/TechniqueUsine.rb +25 -0
  43. data/app/utils/XWing.rb +203 -0
  44. data/app/view/Fenetre.rb +424 -0
  45. data/app/view/FenetreApprentissage.rb +272 -0
  46. data/app/view/FenetreCharger.rb +31 -0
  47. data/app/view/FenetreJeuLibre.rb +468 -0
  48. data/app/view/FenetreMenu.rb +198 -0
  49. data/app/view/FenetreNiveau.rb +105 -0
  50. data/app/view/FenetreNouvellePartie.rb +92 -0
  51. data/app/view/FenetrePrincipale.rb +45 -0
  52. data/app/view/FenetrePseudo.rb +115 -0
  53. data/app/view/FenetreReglages.rb +209 -0
  54. data/app/view/FenetreRegles.rb +111 -0
  55. data/app/view/FenetreScores.rb +120 -0
  56. data/app/view/FenetreStatistiques.rb +134 -0
  57. data/assets/css/style.css +69 -0
  58. data/assets/img/eraser.png +0 -0
  59. data/assets/img/fond.jpg +0 -0
  60. data/assets/img/iconApp.png +0 -0
  61. data/assets/img/logoS.jpeg +0 -0
  62. data/assets/img/sudokuIntro.jpg +0 -0
  63. data/assets/img/user.png +0 -0
  64. data/bin/dogeku +19 -0
  65. data/doc/Action.html +309 -0
  66. data/doc/ApprentissageControleur.html +568 -0
  67. data/doc/CaseDessin.html +2405 -0
  68. data/doc/ChangerCase.html +405 -0
  69. data/doc/ChargerControleur.html +342 -0
  70. data/doc/Conf.html +378 -0
  71. data/doc/Configuration.html +1115 -0
  72. data/doc/Controller.html +1008 -0
  73. data/doc/Core.html +1191 -0
  74. data/doc/DSubset.html +647 -0
  75. data/doc/Fenetre.html +2631 -0
  76. data/doc/FenetreApprentissage.html +1175 -0
  77. data/doc/FenetreCharger.html +343 -0
  78. data/doc/FenetreJeuLibre.html +1859 -0
  79. data/doc/FenetreMenu.html +900 -0
  80. data/doc/FenetreNiveau.html +626 -0
  81. data/doc/FenetreNouvellePartie.html +602 -0
  82. data/doc/FenetrePrincipale.html +371 -0
  83. data/doc/FenetrePseudo.html +695 -0
  84. data/doc/FenetreReglages.html +946 -0
  85. data/doc/FenetreRegles.html +636 -0
  86. data/doc/FenetreScores.html +650 -0
  87. data/doc/FenetreStatistiques.html +672 -0
  88. data/doc/Generateur.html +1015 -0
  89. data/doc/Grille.html +1348 -0
  90. data/doc/GrilleDessin.html +1281 -0
  91. data/doc/HPTriple.html +593 -0
  92. data/doc/Header.html +1253 -0
  93. data/doc/HistoriqueAction.html +792 -0
  94. data/doc/Jeu.html +923 -0
  95. data/doc/JeuLibreControleur.html +1445 -0
  96. data/doc/MenuControleur.html +522 -0
  97. data/doc/Model.html +996 -0
  98. data/doc/NiveauControleur.html +451 -0
  99. data/doc/NouvellePartieControleur.html +330 -0
  100. data/doc/Peche.html +396 -0
  101. data/doc/PrincipaleControleur.html +320 -0
  102. data/doc/PseudoControleur.html +695 -0
  103. data/doc/ReglagesControleur.html +747 -0
  104. data/doc/ReglesControleur.html +330 -0
  105. data/doc/SCandidate.html +617 -0
  106. data/doc/SCell.html +587 -0
  107. data/doc/Score.html +926 -0
  108. data/doc/ScoresControleur.html +346 -0
  109. data/doc/StatistiquesControleur.html +390 -0
  110. data/doc/Technique.html +543 -0
  111. data/doc/TechniqueUsine.html +252 -0
  112. data/doc/Utilisateur.html +806 -0
  113. data/doc/View.html +844 -0
  114. data/doc/XWing.html +1031 -0
  115. data/doc/_index.html +478 -0
  116. data/doc/class_list.html +51 -0
  117. data/doc/css/common.css +1 -0
  118. data/doc/css/full_list.css +58 -0
  119. data/doc/css/style.css +492 -0
  120. data/doc/file.README.html +141 -0
  121. data/doc/file_list.html +56 -0
  122. data/doc/frames.html +17 -0
  123. data/doc/index.html +141 -0
  124. data/doc/js/app.js +243 -0
  125. data/doc/js/full_list.js +216 -0
  126. data/doc/js/jquery.js +4 -0
  127. data/doc/method_list.html +2523 -0
  128. data/doc/top-level-namespace.html +112 -0
  129. data/test/Generateur/grilleCorrecte.rb +198 -0
  130. data/test/Model/scoreCorrecte.rb +55 -0
  131. data/test/Model/utilisateurCorrecte.rb +68 -0
  132. data/test/test_helper.rb +2 -0
  133. data/test/unitTest.rb +72 -0
  134. metadata +187 -0
data/doc/Model.html ADDED
@@ -0,0 +1,996 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>
7
+ Class: Model
8
+
9
+ &mdash; Documentation by YARD 0.9.8
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
16
+
17
+ <script type="text/javascript" charset="utf-8">
18
+ pathId = "Model";
19
+ relpath = '';
20
+ </script>
21
+
22
+
23
+ <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
24
+
25
+ <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
26
+
27
+
28
+ </head>
29
+ <body>
30
+ <div class="nav_wrap">
31
+ <iframe id="nav" src="class_list.html?1"></iframe>
32
+ <div id="resizer"></div>
33
+ </div>
34
+
35
+ <div id="main" tabindex="-1">
36
+ <div id="header">
37
+ <div id="menu">
38
+
39
+ <a href="_index.html">Index (M)</a> &raquo;
40
+
41
+
42
+ <span class="title">Model</span>
43
+
44
+ </div>
45
+
46
+ <div id="search">
47
+
48
+ <a class="full_list_link" id="class_list_link"
49
+ href="class_list.html">
50
+
51
+ <svg width="24" height="24">
52
+ <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
53
+ <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
54
+ <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
55
+ </svg>
56
+ </a>
57
+
58
+ </div>
59
+ <div class="clear"></div>
60
+ </div>
61
+
62
+ <div id="content"><h1>Class: Model
63
+
64
+
65
+
66
+ </h1>
67
+ <div class="box_info">
68
+
69
+ <dl>
70
+ <dt>Inherits:</dt>
71
+ <dd>
72
+ <span class="inheritName">Object</span>
73
+
74
+ <ul class="fullTree">
75
+ <li>Object</li>
76
+
77
+ <li class="next">Model</li>
78
+
79
+ </ul>
80
+ <a href="#" class="inheritanceTree">show all</a>
81
+
82
+ </dd>
83
+ </dl>
84
+
85
+
86
+
87
+
88
+
89
+
90
+ <dl>
91
+ <dt>Includes:</dt>
92
+ <dd>Singleton</dd>
93
+ </dl>
94
+
95
+
96
+
97
+
98
+
99
+
100
+ <dl>
101
+ <dt>Defined in:</dt>
102
+ <dd>app/core/Model.rb</dd>
103
+ </dl>
104
+
105
+ </div>
106
+
107
+ <h2>Overview</h2><div class="docstring">
108
+ <div class="discussion">
109
+
110
+ <p>Classe permettant de gérer la base de données sqlite3</p>
111
+
112
+
113
+ </div>
114
+ </div>
115
+ <div class="tags">
116
+
117
+
118
+ </div><div id="subclasses">
119
+ <h2>Direct Known Subclasses</h2>
120
+ <p class="children"><span class='object_link'><a href="Configuration.html" title="Configuration (class)">Configuration</a></span>, <span class='object_link'><a href="Grille.html" title="Grille (class)">Grille</a></span>, <span class='object_link'><a href="Jeu.html" title="Jeu (class)">Jeu</a></span>, <span class='object_link'><a href="Score.html" title="Score (class)">Score</a></span>, <span class='object_link'><a href="Utilisateur.html" title="Utilisateur (class)">Utilisateur</a></span></p>
121
+ </div>
122
+
123
+
124
+
125
+
126
+ <h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
127
+ <ul class="summary">
128
+
129
+ <li class="public ">
130
+ <span class="summary_signature">
131
+
132
+ <a href="#db-instance_method" title="#db (instance method)">#<strong>db</strong> &#x21d2; Object </a>
133
+
134
+
135
+
136
+ </span>
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ <span class="summary_desc"><div class='inline'>
150
+ <p>Returns the value of attribute db.</p>
151
+ </div></span>
152
+
153
+ </li>
154
+
155
+
156
+ </ul>
157
+
158
+
159
+
160
+
161
+
162
+ <h2>
163
+ Class Method Summary
164
+ <small><a href="#" class="summary_toggle">collapse</a></small>
165
+ </h2>
166
+
167
+ <ul class="summary">
168
+
169
+ <li class="public ">
170
+ <span class="summary_signature">
171
+
172
+ <a href="#inherited-class_method" title="inherited (class method)">.<strong>inherited</strong>(subclass) &#x21d2; Object </a>
173
+
174
+
175
+
176
+ </span>
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+ <span class="summary_desc"><div class='inline'>
187
+ <p>Invoke methods when inherited.</p>
188
+ </div></span>
189
+
190
+ </li>
191
+
192
+
193
+ </ul>
194
+
195
+ <h2>
196
+ Instance Method Summary
197
+ <small><a href="#" class="summary_toggle">collapse</a></small>
198
+ </h2>
199
+
200
+ <ul class="summary">
201
+
202
+ <li class="public ">
203
+ <span class="summary_signature">
204
+
205
+ <a href="#connection-instance_method" title="#connection (instance method)">#<strong>connection</strong>(database) &#x21d2; Object </a>
206
+
207
+
208
+
209
+ </span>
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+ <span class="summary_desc"><div class='inline'>
220
+ <p>Connect to a database.</p>
221
+ </div></span>
222
+
223
+ </li>
224
+
225
+
226
+ <li class="public ">
227
+ <span class="summary_signature">
228
+
229
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong> &#x21d2; Model </a>
230
+
231
+
232
+
233
+ </span>
234
+
235
+
236
+ <span class="note title constructor">constructor</span>
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+ <span class="summary_desc"><div class='inline'>
246
+ <p>Initialisation.</p>
247
+ </div></span>
248
+
249
+ </li>
250
+
251
+
252
+ <li class="public ">
253
+ <span class="summary_signature">
254
+
255
+ <a href="#insert-instance_method" title="#insert (instance method)">#<strong>insert</strong>(**options) &#x21d2; Object </a>
256
+
257
+
258
+
259
+ </span>
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+ <span class="summary_desc"><div class='inline'>
270
+ <p>Insert datas in database.</p>
271
+ </div></span>
272
+
273
+ </li>
274
+
275
+
276
+ <li class="public ">
277
+ <span class="summary_signature">
278
+
279
+ <a href="#mkDatabaseDir-instance_method" title="#mkDatabaseDir (instance method)">#<strong>mkDatabaseDir</strong>(dbPath) &#x21d2; Object </a>
280
+
281
+
282
+
283
+ </span>
284
+
285
+
286
+
287
+
288
+
289
+
290
+
291
+
292
+
293
+ <span class="summary_desc"><div class='inline'>
294
+ <p>Create a new database directory.</p>
295
+ </div></span>
296
+
297
+ </li>
298
+
299
+
300
+ <li class="public ">
301
+ <span class="summary_signature">
302
+
303
+ <a href="#to_h-instance_method" title="#to_h (instance method)">#<strong>to_h</strong>(req) &#x21d2; Object </a>
304
+
305
+
306
+
307
+ </span>
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
317
+ <span class="summary_desc"><div class='inline'>
318
+ <p>Convert an array reques to a hash with columns =&gt; values.</p>
319
+ </div></span>
320
+
321
+ </li>
322
+
323
+
324
+ </ul>
325
+
326
+
327
+
328
+ <div id="constructor_details" class="method_details_list">
329
+ <h2>Constructor Details</h2>
330
+
331
+ <div class="method_details first">
332
+ <h3 class="signature first" id="initialize-instance_method">
333
+
334
+ #<strong>initialize</strong> &#x21d2; <tt><span class='object_link'><a href="" title="Model (class)">Model</a></span></tt>
335
+
336
+
337
+
338
+
339
+
340
+ </h3><div class="docstring">
341
+ <div class="discussion">
342
+
343
+ <p>Initialisation</p>
344
+
345
+
346
+ </div>
347
+ </div>
348
+ <div class="tags">
349
+
350
+
351
+ </div><table class="source_code">
352
+ <tr>
353
+ <td>
354
+ <pre class="lines">
355
+
356
+
357
+ 21
358
+ 22
359
+ 23
360
+ 24
361
+ 25
362
+ 26
363
+ 27
364
+ 28
365
+ 29
366
+ 30
367
+ 31
368
+ 32
369
+ 33
370
+ 34
371
+ 35
372
+ 36</pre>
373
+ </td>
374
+ <td>
375
+ <pre class="code"><span class="info file"># File 'app/core/Model.rb', line 21</span>
376
+
377
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
378
+ <span class='comment'>## Retrieving configuration from yaml files
379
+ </span> <span class='ivar'>@conf</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Conf.html" title="Conf (class)">Conf</a></span></span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='rparen'>)</span>
380
+
381
+ <span class='ivar'>@app</span> <span class='op'>=</span> <span class='ivar'>@conf</span><span class='period'>.</span><span class='id identifier rubyid_app'>app</span>
382
+ <span class='ivar'>@dbConf</span> <span class='op'>=</span> <span class='ivar'>@conf</span><span class='period'>.</span><span class='id identifier rubyid_db'>db</span>
383
+ <span class='cvar'>@@db</span> <span class='op'>=</span> <span class='kw'>nil</span>
384
+
385
+ <span class='id identifier rubyid_dbPath'>dbPath</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="Core.html" title="Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Core.html#ROOT-constant" title="Core::ROOT (constant)">ROOT</a></span></span> <span class='op'>+</span> <span class='const'><span class='object_link'><a href="Core.html" title="Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Core.html#DEFAULT_DATABASE_DIR-constant" title="Core::DEFAULT_DATABASE_DIR (constant)">DEFAULT_DATABASE_DIR</a></span></span>
386
+
387
+ <span class='id identifier rubyid_database'>database</span> <span class='op'>=</span> <span class='id identifier rubyid_dbPath'>dbPath</span> <span class='op'>+</span> <span class='ivar'>@dbConf</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>development</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>database</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
388
+
389
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_mkDatabaseDir'>mkDatabaseDir</span><span class='lparen'>(</span><span class='id identifier rubyid_dbPath'>dbPath</span><span class='rparen'>)</span>
390
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_connection'>connection</span><span class='lparen'>(</span><span class='id identifier rubyid_database'>database</span><span class='rparen'>)</span>
391
+
392
+ <span class='kw'>end</span></pre>
393
+ </td>
394
+ </tr>
395
+ </table>
396
+ </div>
397
+
398
+ </div>
399
+
400
+ <div id="instance_attr_details" class="attr_details">
401
+ <h2>Instance Attribute Details</h2>
402
+
403
+
404
+ <span id="db=-instance_method"></span>
405
+ <div class="method_details first">
406
+ <h3 class="signature first" id="db-instance_method">
407
+
408
+ #<strong>db</strong> &#x21d2; <tt>Object</tt>
409
+
410
+
411
+
412
+
413
+
414
+ </h3><div class="docstring">
415
+ <div class="discussion">
416
+
417
+ <p>Returns the value of attribute db</p>
418
+
419
+
420
+ </div>
421
+ </div>
422
+ <div class="tags">
423
+
424
+
425
+ </div><table class="source_code">
426
+ <tr>
427
+ <td>
428
+ <pre class="lines">
429
+
430
+
431
+ 16
432
+ 17
433
+ 18</pre>
434
+ </td>
435
+ <td>
436
+ <pre class="code"><span class="info file"># File 'app/core/Model.rb', line 16</span>
437
+
438
+ <span class='kw'>def</span> <span class='id identifier rubyid_db'>db</span>
439
+ <span class='ivar'>@db</span>
440
+ <span class='kw'>end</span></pre>
441
+ </td>
442
+ </tr>
443
+ </table>
444
+ </div>
445
+
446
+ </div>
447
+
448
+
449
+ <div id="class_method_details" class="method_details_list">
450
+ <h2>Class Method Details</h2>
451
+
452
+
453
+ <div class="method_details first">
454
+ <h3 class="signature first" id="inherited-class_method">
455
+
456
+ .<strong>inherited</strong>(subclass) &#x21d2; <tt>Object</tt>
457
+
458
+
459
+
460
+
461
+
462
+ </h3><div class="docstring">
463
+ <div class="discussion">
464
+
465
+ <p>Invoke methods when inherited</p>
466
+
467
+
468
+ </div>
469
+ </div>
470
+ <div class="tags">
471
+ <p class="tag_title">Parameters:</p>
472
+ <ul class="param">
473
+
474
+ <li>
475
+
476
+ <span class='name'>subclass</span>
477
+
478
+
479
+ <span class='type'></span>
480
+
481
+
482
+
483
+ &mdash;
484
+ <div class='inline'>
485
+ <p>The subclass</p>
486
+ </div>
487
+
488
+ </li>
489
+
490
+ </ul>
491
+
492
+ <p class="tag_title">Returns:</p>
493
+ <ul class="return">
494
+
495
+ <li>
496
+
497
+
498
+ <span class='type'></span>
499
+
500
+
501
+
502
+
503
+ <div class='inline'>
504
+ <p>Itself</p>
505
+ </div>
506
+
507
+ </li>
508
+
509
+ </ul>
510
+
511
+ </div><table class="source_code">
512
+ <tr>
513
+ <td>
514
+ <pre class="lines">
515
+
516
+
517
+ 91
518
+ 92
519
+ 93
520
+ 94
521
+ 95
522
+ 96</pre>
523
+ </td>
524
+ <td>
525
+ <pre class="code"><span class="info file"># File 'app/core/Model.rb', line 91</span>
526
+
527
+ <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_inherited'>inherited</span><span class='lparen'>(</span><span class='id identifier rubyid_subclass'>subclass</span><span class='rparen'>)</span>
528
+ <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span><span class='lparen'>(</span><span class='rparen'>)</span>
529
+ <span class='kw'>super</span>
530
+
531
+ <span class='kw'>return</span> <span class='kw'>self</span>
532
+ <span class='kw'>end</span></pre>
533
+ </td>
534
+ </tr>
535
+ </table>
536
+ </div>
537
+
538
+ </div>
539
+
540
+ <div id="instance_method_details" class="method_details_list">
541
+ <h2>Instance Method Details</h2>
542
+
543
+
544
+ <div class="method_details first">
545
+ <h3 class="signature first" id="connection-instance_method">
546
+
547
+ #<strong>connection</strong>(database) &#x21d2; <tt>Object</tt>
548
+
549
+
550
+
551
+
552
+
553
+ </h3><div class="docstring">
554
+ <div class="discussion">
555
+
556
+ <p>Connect to a database</p>
557
+
558
+
559
+ </div>
560
+ </div>
561
+ <div class="tags">
562
+ <p class="tag_title">Parameters:</p>
563
+ <ul class="param">
564
+
565
+ <li>
566
+
567
+ <span class='name'>database</span>
568
+
569
+
570
+ <span class='type'></span>
571
+
572
+
573
+
574
+ &mdash;
575
+ <div class='inline'>
576
+ <p>The database</p>
577
+ </div>
578
+
579
+ </li>
580
+
581
+ </ul>
582
+
583
+ <p class="tag_title">Returns:</p>
584
+ <ul class="return">
585
+
586
+ <li>
587
+
588
+
589
+ <span class='type'></span>
590
+
591
+
592
+
593
+
594
+ <div class='inline'>
595
+ <p>Itself</p>
596
+ </div>
597
+
598
+ </li>
599
+
600
+ </ul>
601
+
602
+ </div><table class="source_code">
603
+ <tr>
604
+ <td>
605
+ <pre class="lines">
606
+
607
+
608
+ 65
609
+ 66
610
+ 67
611
+ 68
612
+ 69
613
+ 70
614
+ 71
615
+ 72
616
+ 73
617
+ 74
618
+ 75
619
+ 76
620
+ 77
621
+ 78
622
+ 79
623
+ 80
624
+ 81
625
+ 82</pre>
626
+ </td>
627
+ <td>
628
+ <pre class="code"><span class="info file"># File 'app/core/Model.rb', line 65</span>
629
+
630
+ <span class='kw'>def</span> <span class='id identifier rubyid_connection'>connection</span><span class='lparen'>(</span><span class='id identifier rubyid_database'>database</span><span class='rparen'>)</span>
631
+ <span class='comment'>## Create a SQLite database
632
+ </span> <span class='kw'>if</span> <span class='op'>!</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_database'>database</span><span class='rparen'>)</span>
633
+ <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="Core.html" title="Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Core.html#DEBUG-constant" title="Core::DEBUG (constant)">DEBUG</a></span></span>
634
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>SQLite3 database not found, it will be created.</span><span class='tstring_end'>&quot;</span></span>
635
+ <span class='kw'>end</span>
636
+ <span class='kw'>begin</span>
637
+ <span class='const'>SQLite3</span><span class='op'>::</span><span class='const'>Database</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_database'>database</span><span class='rparen'>)</span>
638
+ <span class='kw'>rescue</span> <span class='const'>SQLite3</span><span class='op'>::</span><span class='const'>Exception</span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_e'>e</span>
639
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>SQLite3 couldn&#39;t create a new database.</span><span class='tstring_end'>&quot;</span></span>
640
+ <span class='kw'>end</span>
641
+ <span class='kw'>end</span>
642
+
643
+ <span class='comment'>## Connect to created dtabase
644
+ </span> <span class='cvar'>@@db</span> <span class='op'>=</span> <span class='const'>SQLite3</span><span class='op'>::</span><span class='const'>Database</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_database'>database</span><span class='rparen'>)</span>
645
+
646
+ <span class='kw'>return</span> <span class='kw'>self</span>
647
+ <span class='kw'>end</span></pre>
648
+ </td>
649
+ </tr>
650
+ </table>
651
+ </div>
652
+
653
+ <div class="method_details ">
654
+ <h3 class="signature " id="insert-instance_method">
655
+
656
+ #<strong>insert</strong>(**options) &#x21d2; <tt>Object</tt>
657
+
658
+
659
+
660
+
661
+
662
+ </h3><div class="docstring">
663
+ <div class="discussion">
664
+
665
+ <p>Insert datas in database</p>
666
+
667
+
668
+ </div>
669
+ </div>
670
+ <div class="tags">
671
+ <p class="tag_title">Parameters:</p>
672
+ <ul class="param">
673
+
674
+ <li>
675
+
676
+ <span class='name'>options</span>
677
+
678
+
679
+ <span class='type'></span>
680
+
681
+
682
+
683
+ &mdash;
684
+ <div class='inline'>
685
+ <p>Hash with columns and values</p>
686
+ </div>
687
+
688
+ </li>
689
+
690
+ </ul>
691
+
692
+ <p class="tag_title">Returns:</p>
693
+ <ul class="return">
694
+
695
+ <li>
696
+
697
+
698
+ <span class='type'></span>
699
+
700
+
701
+
702
+
703
+ <div class='inline'>
704
+ <p>Itself</p>
705
+ </div>
706
+
707
+ </li>
708
+
709
+ </ul>
710
+
711
+ </div><table class="source_code">
712
+ <tr>
713
+ <td>
714
+ <pre class="lines">
715
+
716
+
717
+ 105
718
+ 106
719
+ 107
720
+ 108
721
+ 109
722
+ 110
723
+ 111
724
+ 112
725
+ 113
726
+ 114
727
+ 115
728
+ 116
729
+ 117
730
+ 118
731
+ 119
732
+ 120
733
+ 121
734
+ 122
735
+ 123
736
+ 124
737
+ 125
738
+ 126
739
+ 127
740
+ 128
741
+ 129
742
+ 130
743
+ 131
744
+ 132
745
+ 133
746
+ 134
747
+ 135
748
+ 136</pre>
749
+ </td>
750
+ <td>
751
+ <pre class="code"><span class="info file"># File 'app/core/Model.rb', line 105</span>
752
+
753
+ <span class='kw'>def</span> <span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
754
+ <span class='id identifier rubyid_colsName'>colsName</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
755
+ <span class='id identifier rubyid_values'>values</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
756
+ <span class='id identifier rubyid_bonds'>bonds</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
757
+
758
+ <span class='comment'>## Parse options to get columns and values
759
+ </span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
760
+ <span class='id identifier rubyid_colsName'>colsName</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_index'>index</span>
761
+ <span class='id identifier rubyid_values'>values</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_value'>value</span>
762
+ <span class='id identifier rubyid_bonds'>bonds</span> <span class='op'>&lt;&lt;</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>?</span><span class='tstring_end'>&quot;</span></span>
763
+ <span class='kw'>end</span>
764
+
765
+ <span class='id identifier rubyid_colsName'>colsName</span> <span class='op'>=</span> <span class='id identifier rubyid_colsName'>colsName</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
766
+ <span class='id identifier rubyid_bonds'>bonds</span> <span class='op'>=</span> <span class='id identifier rubyid_bonds'>bonds</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>,</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span>
767
+
768
+ <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="Core.html" title="Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Core.html#DEBUG-constant" title="Core::DEBUG (constant)">DEBUG</a></span></span>
769
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Request: INSERT INTO </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_colsName'>colsName</span><span class='embexpr_end'>}</span><span class='tstring_content'>) VALUES (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_bonds'>bonds</span><span class='embexpr_end'>}</span><span class='tstring_content'>);</span><span class='tstring_end'>&quot;</span></span>
770
+
771
+ <span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Values was: </span><span class='tstring_end'>&quot;</span></span>
772
+ <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_index'>index</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span>
773
+ <span class='id identifier rubyid_print'>print</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_index'>index</span><span class='embexpr_end'>}</span><span class='tstring_content'> =&gt; </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_value'>value</span><span class='embexpr_end'>}</span><span class='tstring_content'> | </span><span class='tstring_end'>&quot;</span></span>
774
+ <span class='kw'>end</span>
775
+
776
+ <span class='id identifier rubyid_puts'>puts</span>
777
+ <span class='id identifier rubyid_puts'>puts</span>
778
+ <span class='kw'>end</span>
779
+
780
+ <span class='cvar'>@@db</span><span class='period'>.</span><span class='id identifier rubyid_execute'>execute</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>INSERT INTO </span><span class='tstring_end'>&quot;</span></span> <span class='op'>+</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_colsName'>colsName</span><span class='embexpr_end'>}</span><span class='tstring_content'>)
781
+ VALUES (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_bonds'>bonds</span><span class='embexpr_end'>}</span><span class='tstring_content'>);</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_values'>values</span>
782
+
783
+ <span class='kw'>return</span> <span class='kw'>self</span>
784
+ <span class='kw'>end</span></pre>
785
+ </td>
786
+ </tr>
787
+ </table>
788
+ </div>
789
+
790
+ <div class="method_details ">
791
+ <h3 class="signature " id="mkDatabaseDir-instance_method">
792
+
793
+ #<strong>mkDatabaseDir</strong>(dbPath) &#x21d2; <tt>Object</tt>
794
+
795
+
796
+
797
+
798
+
799
+ </h3><div class="docstring">
800
+ <div class="discussion">
801
+
802
+ <p>Create a new database directory</p>
803
+
804
+
805
+ </div>
806
+ </div>
807
+ <div class="tags">
808
+ <p class="tag_title">Parameters:</p>
809
+ <ul class="param">
810
+
811
+ <li>
812
+
813
+ <span class='name'>dbPath</span>
814
+
815
+
816
+ <span class='type'></span>
817
+
818
+
819
+
820
+ &mdash;
821
+ <div class='inline'>
822
+ <p>The database path</p>
823
+ </div>
824
+
825
+ </li>
826
+
827
+ </ul>
828
+
829
+ <p class="tag_title">Returns:</p>
830
+ <ul class="return">
831
+
832
+ <li>
833
+
834
+
835
+ <span class='type'></span>
836
+
837
+
838
+
839
+
840
+ <div class='inline'>
841
+ <p>Itself</p>
842
+ </div>
843
+
844
+ </li>
845
+
846
+ </ul>
847
+
848
+ </div><table class="source_code">
849
+ <tr>
850
+ <td>
851
+ <pre class="lines">
852
+
853
+
854
+ 45
855
+ 46
856
+ 47
857
+ 48
858
+ 49
859
+ 50
860
+ 51
861
+ 52
862
+ 53
863
+ 54
864
+ 55</pre>
865
+ </td>
866
+ <td>
867
+ <pre class="code"><span class="info file"># File 'app/core/Model.rb', line 45</span>
868
+
869
+ <span class='kw'>def</span> <span class='id identifier rubyid_mkDatabaseDir'>mkDatabaseDir</span><span class='lparen'>(</span><span class='id identifier rubyid_dbPath'>dbPath</span><span class='rparen'>)</span>
870
+ <span class='comment'>## Create a new database directory if not existing
871
+ </span> <span class='kw'>if</span> <span class='op'>!</span><span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_dbPath'>dbPath</span><span class='rparen'>)</span>
872
+ <span class='kw'>if</span> <span class='const'><span class='object_link'><a href="Core.html" title="Core (module)">Core</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Core.html#DEBUG-constant" title="Core::DEBUG (constant)">DEBUG</a></span></span>
873
+ <span class='id identifier rubyid_puts'>puts</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Database directory not found, it will be created.</span><span class='tstring_end'>&quot;</span></span>
874
+ <span class='kw'>end</span>
875
+ <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_mkdir'>mkdir</span><span class='lparen'>(</span><span class='id identifier rubyid_dbPath'>dbPath</span><span class='rparen'>)</span>
876
+ <span class='kw'>end</span>
877
+
878
+ <span class='kw'>return</span> <span class='kw'>self</span>
879
+ <span class='kw'>end</span></pre>
880
+ </td>
881
+ </tr>
882
+ </table>
883
+ </div>
884
+
885
+ <div class="method_details ">
886
+ <h3 class="signature " id="to_h-instance_method">
887
+
888
+ #<strong>to_h</strong>(req) &#x21d2; <tt>Object</tt>
889
+
890
+
891
+
892
+
893
+
894
+ </h3><div class="docstring">
895
+ <div class="discussion">
896
+
897
+ <p>Convert an array reques to a hash with columns =&gt; values</p>
898
+
899
+
900
+ </div>
901
+ </div>
902
+ <div class="tags">
903
+ <p class="tag_title">Parameters:</p>
904
+ <ul class="param">
905
+
906
+ <li>
907
+
908
+ <span class='name'>req</span>
909
+
910
+
911
+ <span class='type'></span>
912
+
913
+
914
+
915
+ &mdash;
916
+ <div class='inline'>
917
+ <p>The request</p>
918
+ </div>
919
+
920
+ </li>
921
+
922
+ </ul>
923
+
924
+ <p class="tag_title">Returns:</p>
925
+ <ul class="return">
926
+
927
+ <li>
928
+
929
+
930
+ <span class='type'></span>
931
+
932
+
933
+
934
+
935
+ <div class='inline'>
936
+ <p>Request hashed</p>
937
+ </div>
938
+
939
+ </li>
940
+
941
+ </ul>
942
+
943
+ </div><table class="source_code">
944
+ <tr>
945
+ <td>
946
+ <pre class="lines">
947
+
948
+
949
+ 145
950
+ 146
951
+ 147
952
+ 148
953
+ 149
954
+ 150
955
+ 151
956
+ 152
957
+ 153
958
+ 154
959
+ 155
960
+ 156
961
+ 157</pre>
962
+ </td>
963
+ <td>
964
+ <pre class="code"><span class="info file"># File 'app/core/Model.rb', line 145</span>
965
+
966
+ <span class='kw'>def</span> <span class='id identifier rubyid_to_h'>to_h</span><span class='lparen'>(</span><span class='id identifier rubyid_req'>req</span><span class='rparen'>)</span>
967
+ <span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='rparen'>)</span>
968
+
969
+ <span class='comment'>## Transforme la réponse en hash
970
+ </span> <span class='lparen'>(</span><span class='int'>1</span><span class='op'>...</span><span class='id identifier rubyid_req'>req</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_row'>row</span><span class='op'>|</span>
971
+ <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='id identifier rubyid_row'>row</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='const'>Hash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='rparen'>)</span>
972
+ <span class='lparen'>(</span><span class='int'>0</span><span class='op'>...</span><span class='id identifier rubyid_req'>req</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_col'>col</span><span class='op'>|</span>
973
+ <span class='id identifier rubyid_response'>response</span><span class='lbracket'>[</span><span class='id identifier rubyid_row'>row</span><span class='op'>-</span><span class='int'>1</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_req'>req</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_req'>req</span><span class='lbracket'>[</span><span class='id identifier rubyid_row'>row</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_col'>col</span><span class='rbracket'>]</span>
974
+ <span class='kw'>end</span>
975
+ <span class='kw'>end</span>
976
+
977
+ <span class='kw'>return</span> <span class='id identifier rubyid_response'>response</span>
978
+ <span class='kw'>end</span></pre>
979
+ </td>
980
+ </tr>
981
+ </table>
982
+ </div>
983
+
984
+ </div>
985
+
986
+ </div>
987
+
988
+ <div id="footer">
989
+ Generated on Sat Apr 22 22:47:30 2017 by
990
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
991
+ 0.9.8 (ruby-2.3.3).
992
+ </div>
993
+
994
+ </div>
995
+ </body>
996
+ </html>