pose 1.3.4 → 2.0.0

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 (76) hide show
  1. data/README.md +11 -0
  2. data/Rakefile +4 -2
  3. data/app/models/pose/assignment.rb +34 -0
  4. data/app/models/pose/word.rb +24 -0
  5. data/db/migrate/20130308144915_pose_install.rb +18 -0
  6. data/lib/generators/pose/remove/templates/remove_migration.rb +3 -5
  7. data/lib/generators/pose/upgrade/templates/upgrade_migration.rb +9 -0
  8. data/lib/generators/pose/upgrade/upgrade_generator.rb +35 -0
  9. data/lib/pose/activerecord_base_additions.rb +5 -2
  10. data/lib/pose/engine.rb +5 -0
  11. data/lib/pose/internal_helpers.rb +13 -7
  12. data/lib/pose/{model_additions.rb → model_class_additions.rb} +8 -8
  13. data/lib/pose/railtie.rb +1 -2
  14. data/lib/pose/static_api.rb +5 -6
  15. data/lib/pose/version.rb +1 -1
  16. data/lib/pose.rb +5 -7
  17. data/lib/tasks/pose_tasks.rake +27 -29
  18. data/spec/dummy/Rakefile +7 -0
  19. data/spec/{support/models.rb → dummy/app/models/posable_one.rb} +1 -4
  20. data/spec/dummy/app/models/posable_two.rb +5 -0
  21. data/spec/dummy/config/application.rb +59 -0
  22. data/spec/dummy/config/boot.rb +10 -0
  23. data/spec/dummy/config/database.yml +25 -0
  24. data/spec/dummy/config/environment.rb +5 -0
  25. data/spec/dummy/config/environments/development.rb +37 -0
  26. data/spec/dummy/config/environments/production.rb +67 -0
  27. data/spec/dummy/config/environments/test.rb +37 -0
  28. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/spec/dummy/config/initializers/inflections.rb +15 -0
  30. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  31. data/spec/dummy/config/initializers/secret_token.rb +7 -0
  32. data/spec/dummy/config/initializers/session_store.rb +8 -0
  33. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  34. data/spec/dummy/config/locales/en.yml +5 -0
  35. data/spec/dummy/config/routes.rb +2 -0
  36. data/spec/dummy/config.ru +4 -0
  37. data/spec/dummy/db/migrate/20130308054001_create_posable_one.rb +8 -0
  38. data/spec/dummy/db/migrate/20130308054142_create_posable_two.rb +9 -0
  39. data/spec/dummy/db/schema.rb +41 -0
  40. data/spec/dummy/script/rails +6 -0
  41. data/spec/factories/assignments.rb +8 -0
  42. data/spec/factories/posable_one.rb +5 -0
  43. data/spec/factories/words.rb +7 -0
  44. data/spec/internal_helpers_spec.rb +40 -42
  45. data/spec/models/assignment_spec.rb +46 -0
  46. data/spec/models/word_spec.rb +42 -0
  47. data/spec/pose_api_spec.rb +198 -196
  48. data/spec/spec_helper.rb +21 -77
  49. data/spec/support/matchers.rb +0 -1
  50. metadata +83 -102
  51. data/doc/Pose/InstanceMethods.html +0 -341
  52. data/doc/Pose.html +0 -774
  53. data/doc/PoseAssignment.html +0 -125
  54. data/doc/PoseGenerator.html +0 -255
  55. data/doc/PoseMigrations.html +0 -261
  56. data/doc/PoseWord.html +0 -125
  57. data/doc/_index.html +0 -134
  58. data/doc/class_list.html +0 -47
  59. data/doc/css/common.css +0 -1
  60. data/doc/css/full_list.css +0 -55
  61. data/doc/css/style.css +0 -322
  62. data/doc/file_list.html +0 -46
  63. data/doc/frames.html +0 -13
  64. data/doc/index.html +0 -134
  65. data/doc/js/app.js +0 -205
  66. data/doc/js/full_list.js +0 -167
  67. data/doc/js/jquery.js +0 -16
  68. data/doc/method_list.html +0 -150
  69. data/doc/top-level-namespace.html +0 -172
  70. data/lib/generators/pose/install/install_generator.rb +0 -56
  71. data/lib/generators/pose/install/templates/install_migration.rb +0 -24
  72. data/lib/pose/models/pose_assignment.rb +0 -31
  73. data/lib/pose/models/pose_word.rb +0 -28
  74. data/spec/factories.rb +0 -15
  75. data/spec/pose_assignment_spec.rb +0 -45
  76. data/spec/pose_word_spec.rb +0 -26
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: pose
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.3.4
5
+ version: 2.0.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Kevin Goslar
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-13 00:00:00.000000000 Z
12
+ date: 2013-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  prerelease: false
@@ -27,22 +27,6 @@ dependencies:
27
27
  - !ruby/object:Gem::Version
28
28
  version: 3.0.0
29
29
  none: false
30
- - !ruby/object:Gem::Dependency
31
- prerelease: false
32
- version_requirements: !ruby/object:Gem::Requirement
33
- requirements:
34
- - - ! '>='
35
- - !ruby/object:Gem::Version
36
- version: '0'
37
- none: false
38
- type: :runtime
39
- name: rake
40
- requirement: !ruby/object:Gem::Requirement
41
- requirements:
42
- - - ! '>='
43
- - !ruby/object:Gem::Version
44
- version: '0'
45
- none: false
46
30
  - !ruby/object:Gem::Dependency
47
31
  prerelease: false
48
32
  version_requirements: !ruby/object:Gem::Requirement
@@ -68,39 +52,7 @@ dependencies:
68
52
  version: '0'
69
53
  none: false
70
54
  type: :development
71
- name: autotest-standalone
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- none: false
78
- - !ruby/object:Gem::Dependency
79
- prerelease: false
80
- version_requirements: !ruby/object:Gem::Requirement
81
- requirements:
82
- - - ! '>='
83
- - !ruby/object:Gem::Version
84
- version: '0'
85
- none: false
86
- type: :development
87
- name: database_cleaner
88
- requirement: !ruby/object:Gem::Requirement
89
- requirements:
90
- - - ! '>='
91
- - !ruby/object:Gem::Version
92
- version: '0'
93
- none: false
94
- - !ruby/object:Gem::Dependency
95
- prerelease: false
96
- version_requirements: !ruby/object:Gem::Requirement
97
- requirements:
98
- - - ! '>='
99
- - !ruby/object:Gem::Version
100
- version: '0'
101
- none: false
102
- type: :development
103
- name: factory_girl
55
+ name: factory_girl_rails
104
56
  requirement: !ruby/object:Gem::Requirement
105
57
  requirements:
106
58
  - - ! '>='
@@ -132,23 +84,7 @@ dependencies:
132
84
  version: '0'
133
85
  none: false
134
86
  type: :development
135
- name: hashie
136
- requirement: !ruby/object:Gem::Requirement
137
- requirements:
138
- - - ! '>='
139
- - !ruby/object:Gem::Version
140
- version: '0'
141
- none: false
142
- - !ruby/object:Gem::Dependency
143
- prerelease: false
144
- version_requirements: !ruby/object:Gem::Requirement
145
- requirements:
146
- - - ! '>='
147
- - !ruby/object:Gem::Version
148
- version: '0'
149
- none: false
150
- type: :development
151
- name: rspec
87
+ name: rspec-rails
152
88
  requirement: !ruby/object:Gem::Requirement
153
89
  requirements:
154
90
  - - ! '>='
@@ -164,7 +100,7 @@ dependencies:
164
100
  version: '0'
165
101
  none: false
166
102
  type: :development
167
- name: pg
103
+ name: sqlite3
168
104
  requirement: !ruby/object:Gem::Requirement
169
105
  requirements:
170
106
  - - ! '>='
@@ -178,34 +114,17 @@ executables: []
178
114
  extensions: []
179
115
  extra_rdoc_files: []
180
116
  files:
181
- - doc/_index.html
182
- - doc/class_list.html
183
- - doc/css/common.css
184
- - doc/css/full_list.css
185
- - doc/css/style.css
186
- - doc/file_list.html
187
- - doc/frames.html
188
- - doc/index.html
189
- - doc/js/app.js
190
- - doc/js/full_list.js
191
- - doc/js/jquery.js
192
- - doc/method_list.html
193
- - doc/Pose/InstanceMethods.html
194
- - doc/Pose.html
195
- - doc/PoseAssignment.html
196
- - doc/PoseGenerator.html
197
- - doc/PoseMigrations.html
198
- - doc/PoseWord.html
199
- - doc/top-level-namespace.html
200
- - lib/generators/pose/install/install_generator.rb
201
- - lib/generators/pose/install/templates/install_migration.rb
117
+ - app/models/pose/assignment.rb
118
+ - app/models/pose/word.rb
119
+ - db/migrate/20130308144915_pose_install.rb
202
120
  - lib/generators/pose/remove/remove_generator.rb
203
121
  - lib/generators/pose/remove/templates/remove_migration.rb
122
+ - lib/generators/pose/upgrade/templates/upgrade_migration.rb
123
+ - lib/generators/pose/upgrade/upgrade_generator.rb
204
124
  - lib/pose/activerecord_base_additions.rb
125
+ - lib/pose/engine.rb
205
126
  - lib/pose/internal_helpers.rb
206
- - lib/pose/model_additions.rb
207
- - lib/pose/models/pose_assignment.rb
208
- - lib/pose/models/pose_word.rb
127
+ - lib/pose/model_class_additions.rb
209
128
  - lib/pose/railtie.rb
210
129
  - lib/pose/static_api.rb
211
130
  - lib/pose/version.rb
@@ -214,17 +133,55 @@ files:
214
133
  - MIT-LICENSE
215
134
  - Rakefile
216
135
  - README.md
217
- - spec/factories.rb
136
+ - spec/dummy/app/models/posable_one.rb
137
+ - spec/dummy/app/models/posable_two.rb
138
+ - spec/dummy/config/application.rb
139
+ - spec/dummy/config/boot.rb
140
+ - spec/dummy/config/database.yml
141
+ - spec/dummy/config/environment.rb
142
+ - spec/dummy/config/environments/development.rb
143
+ - spec/dummy/config/environments/production.rb
144
+ - spec/dummy/config/environments/test.rb
145
+ - spec/dummy/config/initializers/backtrace_silencers.rb
146
+ - spec/dummy/config/initializers/inflections.rb
147
+ - spec/dummy/config/initializers/mime_types.rb
148
+ - spec/dummy/config/initializers/secret_token.rb
149
+ - spec/dummy/config/initializers/session_store.rb
150
+ - spec/dummy/config/initializers/wrap_parameters.rb
151
+ - spec/dummy/config/locales/en.yml
152
+ - spec/dummy/config/routes.rb
153
+ - spec/dummy/config.ru
154
+ - spec/dummy/db/migrate/20130308054001_create_posable_one.rb
155
+ - spec/dummy/db/migrate/20130308054142_create_posable_two.rb
156
+ - spec/dummy/db/schema.rb
157
+ - spec/dummy/Rakefile
158
+ - spec/dummy/script/rails
159
+ - spec/factories/assignments.rb
160
+ - spec/factories/posable_one.rb
161
+ - spec/factories/words.rb
218
162
  - spec/internal_helpers_spec.rb
163
+ - spec/models/assignment_spec.rb
164
+ - spec/models/word_spec.rb
219
165
  - spec/pose_api_spec.rb
220
- - spec/pose_assignment_spec.rb
221
- - spec/pose_word_spec.rb
222
166
  - spec/spec_helper.rb
223
167
  - spec/support/matchers.rb
224
- - spec/support/models.rb
225
168
  homepage: http://github.com/kevgo/pose
226
169
  licenses: []
227
- post_install_message:
170
+ post_install_message: ! '
171
+
172
+ HEADS UP! If you have used Pose 1.x before,
173
+
174
+ you need to update your database tables!
175
+
176
+
177
+ * run: rails g pose:upgrade
178
+
179
+ * run: rake db:migrate
180
+
181
+
182
+ For more information, see: https://github.com/kevgo/pose
183
+
184
+ '
228
185
  rdoc_options: []
229
186
  require_paths:
230
187
  - lib
@@ -247,11 +204,35 @@ signing_key:
247
204
  specification_version: 3
248
205
  summary: A polymorphic, storage-system independent search engine for Ruby on Rails.
249
206
  test_files:
250
- - spec/factories.rb
207
+ - spec/dummy/app/models/posable_one.rb
208
+ - spec/dummy/app/models/posable_two.rb
209
+ - spec/dummy/config/application.rb
210
+ - spec/dummy/config/boot.rb
211
+ - spec/dummy/config/database.yml
212
+ - spec/dummy/config/environment.rb
213
+ - spec/dummy/config/environments/development.rb
214
+ - spec/dummy/config/environments/production.rb
215
+ - spec/dummy/config/environments/test.rb
216
+ - spec/dummy/config/initializers/backtrace_silencers.rb
217
+ - spec/dummy/config/initializers/inflections.rb
218
+ - spec/dummy/config/initializers/mime_types.rb
219
+ - spec/dummy/config/initializers/secret_token.rb
220
+ - spec/dummy/config/initializers/session_store.rb
221
+ - spec/dummy/config/initializers/wrap_parameters.rb
222
+ - spec/dummy/config/locales/en.yml
223
+ - spec/dummy/config/routes.rb
224
+ - spec/dummy/config.ru
225
+ - spec/dummy/db/migrate/20130308054001_create_posable_one.rb
226
+ - spec/dummy/db/migrate/20130308054142_create_posable_two.rb
227
+ - spec/dummy/db/schema.rb
228
+ - spec/dummy/Rakefile
229
+ - spec/dummy/script/rails
230
+ - spec/factories/assignments.rb
231
+ - spec/factories/posable_one.rb
232
+ - spec/factories/words.rb
251
233
  - spec/internal_helpers_spec.rb
234
+ - spec/models/assignment_spec.rb
235
+ - spec/models/word_spec.rb
252
236
  - spec/pose_api_spec.rb
253
- - spec/pose_assignment_spec.rb
254
- - spec/pose_word_spec.rb
255
237
  - spec/spec_helper.rb
256
238
  - spec/support/matchers.rb
257
- - spec/support/models.rb
@@ -1,341 +0,0 @@
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: Pose::InstanceMethods
8
-
9
- &mdash; Documentation by YARD 0.7.3
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 (I)</a> &raquo;
37
- <span class='title'><span class='object_link'><a href="../Pose.html" title="Pose (module)">Pose</a></span></span>
38
- &raquo;
39
- <span class="title">InstanceMethods</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: Pose::InstanceMethods
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/pose.rb</dd>
76
-
77
- </dl>
78
- <div class="clear"></div>
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
- <h2>
87
- Instance Method Summary
88
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
89
- </h2>
90
-
91
- <ul class="summary">
92
-
93
- <li class="public ">
94
- <span class="summary_signature">
95
-
96
- <a href="#delete_pose_index-instance_method" title="#delete_pose_index (instance method)">- (Object) <strong>delete_pose_index</strong> </a>
97
-
98
-
99
-
100
- </span>
101
-
102
-
103
-
104
-
105
-
106
-
107
-
108
-
109
- <span class="summary_desc"><div class='inline'>Removes this objects from the search index.</div></span>
110
-
111
- </li>
112
-
113
-
114
- <li class="public ">
115
- <span class="summary_signature">
116
-
117
- <a href="#update_pose_index-instance_method" title="#update_pose_index (instance method)">- (Object) <strong>update_pose_index</strong> </a>
118
-
119
-
120
-
121
- </span>
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
- <span class="summary_desc"><div class='inline'>Updates the associated words for this object in the database.</div></span>
131
-
132
- </li>
133
-
134
-
135
- <li class="public ">
136
- <span class="summary_signature">
137
-
138
- <a href="#update_pose_words-instance_method" title="#update_pose_words (instance method)">- (Object) <strong>update_pose_words</strong> </a>
139
-
140
-
141
-
142
- </span>
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
- <span class="summary_desc"><div class='inline'>Helper method.</div></span>
152
-
153
- </li>
154
-
155
-
156
- </ul>
157
-
158
-
159
-
160
-
161
- <div id="instance_method_details" class="method_details_list">
162
- <h2>Instance Method Details</h2>
163
-
164
-
165
- <div class="method_details first">
166
- <p class="signature first" id="delete_pose_index-instance_method">
167
-
168
- - (<tt>Object</tt>) <strong>delete_pose_index</strong>
169
-
170
-
171
-
172
- </p><div class="docstring">
173
- <div class="discussion">
174
- Removes this objects from the search index.
175
-
176
- </div>
177
- </div>
178
- <div class="tags">
179
-
180
-
181
- </div><table class="source_code">
182
- <tr>
183
- <td>
184
- <pre class="lines">
185
-
186
-
187
- 29
188
- 30
189
- 31
190
- 32</pre>
191
- </td>
192
- <td>
193
- <pre class="code"><span class="info file"># File 'lib/pose.rb', line 29</span>
194
-
195
- <span class='def def kw'>def</span> <span class='delete_pose_index identifier id'>delete_pose_index</span>
196
- <span class='return return kw'>return</span> <span class='if if_mod kw'>if</span> <span class='Rails constant id'>Rails</span><span class='dot token'>.</span><span class='env identifier id'>env</span> <span class='eq op'>==</span> <span class='string val'>'test'</span> <span class='and and kw'>and</span> <span class='notop op'>!</span><span class='CONFIGURATION constant id'>CONFIGURATION</span><span class='lbrack token'>[</span><span class='symbol val'>:search_in_tests</span><span class='rbrack token'>]</span>
197
- <span class='self self kw'>self</span><span class='dot token'>.</span><span class='words identifier id'>words</span><span class='dot token'>.</span><span class='clear identifier id'>clear</span>
198
- <span class='end end kw'>end</span>
199
- </pre>
200
- </td>
201
- </tr>
202
- </table>
203
- </div>
204
-
205
- <div class="method_details ">
206
- <p class="signature " id="update_pose_index-instance_method">
207
-
208
- - (<tt>Object</tt>) <strong>update_pose_index</strong>
209
-
210
-
211
-
212
- </p><div class="docstring">
213
- <div class="discussion">
214
- Updates the associated words for this object in the database.
215
-
216
- </div>
217
- </div>
218
- <div class="tags">
219
-
220
-
221
- </div><table class="source_code">
222
- <tr>
223
- <td>
224
- <pre class="lines">
225
-
226
-
227
- 20
228
- 21
229
- 22
230
- 23
231
- 24
232
- 25
233
- 26</pre>
234
- </td>
235
- <td>
236
- <pre class="code"><span class="info file"># File 'lib/pose.rb', line 20</span>
237
-
238
- <span class='def def kw'>def</span> <span class='update_pose_index identifier id'>update_pose_index</span>
239
-
240
- <span class='comment val'># Don't do this in tests.</span>
241
- <span class='return return kw'>return</span> <span class='if if_mod kw'>if</span> <span class='Rails constant id'>Rails</span><span class='dot token'>.</span><span class='env identifier id'>env</span> <span class='eq op'>==</span> <span class='string val'>'test'</span> <span class='and and kw'>and</span> <span class='notop op'>!</span><span class='CONFIGURATION constant id'>CONFIGURATION</span><span class='lbrack token'>[</span><span class='symbol val'>:search_in_tests</span><span class='rbrack token'>]</span>
242
-
243
- <span class='update_pose_words identifier id'>update_pose_words</span>
244
- <span class='end end kw'>end</span>
245
- </pre>
246
- </td>
247
- </tr>
248
- </table>
249
- </div>
250
-
251
- <div class="method_details ">
252
- <p class="signature " id="update_pose_words-instance_method">
253
-
254
- - (<tt>Object</tt>) <strong>update_pose_words</strong>
255
-
256
-
257
-
258
- </p><div class="docstring">
259
- <div class="discussion">
260
- Helper method.
261
- Updates the search words with the text returned by search_strings.
262
-
263
- </div>
264
- </div>
265
- <div class="tags">
266
-
267
-
268
- </div><table class="source_code">
269
- <tr>
270
- <td>
271
- <pre class="lines">
272
-
273
-
274
- 36
275
- 37
276
- 38
277
- 39
278
- 40
279
- 41
280
- 42
281
- 43
282
- 44
283
- 45
284
- 46
285
- 47
286
- 48
287
- 49
288
- 50
289
- 51
290
- 52
291
- 53
292
- 54
293
- 55
294
- 56
295
- 57
296
- 58</pre>
297
- </td>
298
- <td>
299
- <pre class="code"><span class="info file"># File 'lib/pose.rb', line 36</span>
300
-
301
- <span class='def def kw'>def</span> <span class='update_pose_words identifier id'>update_pose_words</span>
302
-
303
- <span class='comment val'># Step 1: get an array of all words for the current object.</span>
304
- <span class='new_words identifier id'>new_words</span> <span class='assign token'>=</span> <span class='lbrack token'>[</span><span class='rbrack token'>]</span>
305
- <span class='search_strings identifier id'>search_strings</span> <span class='assign token'>=</span> <span class='self self kw'>self</span><span class='dot token'>.</span><span class='pose_content identifier id'>pose_content</span>
306
- <span class='search_strings identifier id'>search_strings</span><span class='dot token'>.</span><span class='flatten identifier id'>flatten</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='text identifier id'>text</span><span class='bitor op'>|</span>
307
- <span class='next next kw'>next</span> <span class='unless unless_mod kw'>unless</span> <span class='text identifier id'>text</span>
308
- <span class='text identifier id'>text</span><span class='dot token'>.</span><span class='to_s identifier id'>to_s</span><span class='dot token'>.</span><span class='split identifier id'>split</span><span class='lparen token'>(</span><span class='string val'>' '</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='word identifier id'>word</span><span class='bitor op'>|</span>
309
- <span class='new_words identifier id'>new_words</span><span class='dot token'>.</span><span class='concat identifier id'>concat</span> <span class='Pose constant id'>Pose</span><span class='dot token'>.</span><span class='root_word identifier id'>root_word</span><span class='lparen token'>(</span><span class='word identifier id'>word</span><span class='rparen token'>)</span>
310
- <span class='end end kw'>end</span>
311
- <span class='end end kw'>end</span>
312
- <span class='new_words identifier id'>new_words</span><span class='dot token'>.</span><span class='uniq! fid id'>uniq!</span>
313
-
314
- <span class='comment val'># Step 2: Add new words to the search index.</span>
315
- <span class='Pose constant id'>Pose</span><span class='dot token'>.</span><span class='get_words_to_add identifier id'>get_words_to_add</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='dot token'>.</span><span class='pose_words identifier id'>pose_words</span><span class='comma token'>,</span> <span class='new_words identifier id'>new_words</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='word_to_add identifier id'>word_to_add</span><span class='bitor op'>|</span>
316
- <span class='self self kw'>self</span><span class='dot token'>.</span><span class='pose_words identifier id'>pose_words</span> <span class='lshft op'>&lt;&lt;</span> <span class='PoseWord constant id'>PoseWord</span><span class='dot token'>.</span><span class='find_or_create_by_text identifier id'>find_or_create_by_text</span><span class='lparen token'>(</span><span class='word_to_add identifier id'>word_to_add</span><span class='rparen token'>)</span>
317
- <span class='end end kw'>end</span>
318
-
319
- <span class='comment val'># Step 3: Remove now obsolete words from search index.</span>
320
- <span class='Pose constant id'>Pose</span><span class='dot token'>.</span><span class='get_words_to_remove identifier id'>get_words_to_remove</span><span class='lparen token'>(</span><span class='self self kw'>self</span><span class='dot token'>.</span><span class='pose_words identifier id'>pose_words</span><span class='comma token'>,</span> <span class='new_words identifier id'>new_words</span><span class='rparen token'>)</span><span class='dot token'>.</span><span class='each identifier id'>each</span> <span class='do do kw'>do</span> <span class='bitor op'>|</span><span class='word_to_remove identifier id'>word_to_remove</span><span class='bitor op'>|</span>
321
- <span class='self self kw'>self</span><span class='dot token'>.</span><span class='pose_words identifier id'>pose_words</span><span class='dot token'>.</span><span class='delete identifier id'>delete</span> <span class='word_to_remove identifier id'>word_to_remove</span>
322
- <span class='end end kw'>end</span>
323
- <span class='end end kw'>end</span>
324
- </pre>
325
- </td>
326
- </tr>
327
- </table>
328
- </div>
329
-
330
- </div>
331
-
332
- </div>
333
-
334
- <div id="footer">
335
- Generated on Wed Nov 16 11:48:27 2011 by
336
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
337
- 0.7.3 (ruby-1.8.7).
338
- </div>
339
-
340
- </body>
341
- </html>