sadie 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/lib/sadie/version.rb +1 -1
- data/lib/sadie.rb +113 -12
- data/rdoc/classes/Sadie.html +306 -45
- data/rdoc/created.rid +1 -1
- data/rdoc/files/lib/sadie/version_rb.html +1 -1
- data/rdoc/files/lib/sadie_rb.html +1 -1
- data/rdoc/fr_method_index.html +11 -4
- data/test/tc_sadie_toplevel.rb +9 -0
- data/test/test_primers/.toplevel_double.res.rb.kate-swp +0 -0
- data/test/test_primers/toplevel_destructonget.res.rb +11 -0
- metadata +6 -3
data/CHANGELOG
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Up to v0.0.6: getting it all working
|
data/lib/sadie/version.rb
CHANGED
data/lib/sadie.rb
CHANGED
@@ -39,6 +39,7 @@ class Sadie
|
|
39
39
|
@shortterm = Hash.new
|
40
40
|
@flag_expensive = Hash.new
|
41
41
|
@flag_primed = Hash.new
|
42
|
+
@flag_eachtimeprime = Hash.new
|
42
43
|
|
43
44
|
# init class
|
44
45
|
Sadie::_checkSanity
|
@@ -136,18 +137,44 @@ class Sadie
|
|
136
137
|
# completely behind-the-scenes as directed by the resource (.res) files
|
137
138
|
def get( k )
|
138
139
|
|
140
|
+
# if it's already set, return known answer
|
141
|
+
if _isset?( k )
|
142
|
+
|
143
|
+
# _get the return value
|
144
|
+
return_value = _get( k )
|
145
|
+
|
146
|
+
# unset and unprime if destructOnGet?
|
147
|
+
if destructOnGet?( k )
|
148
|
+
# puts "destructing #{k}"
|
149
|
+
unset( k )
|
150
|
+
unprime( k )
|
151
|
+
end
|
152
|
+
|
153
|
+
return return_value
|
154
|
+
end
|
155
|
+
|
139
156
|
# prime if not yet primed
|
140
157
|
primed?( k ) \
|
141
158
|
or _prime( k )
|
142
159
|
|
143
160
|
# if not expensive, then return what's already known
|
144
161
|
expensive?( k ) \
|
145
|
-
|
162
|
+
and return _recallExpensive( k )
|
146
163
|
|
147
|
-
#
|
148
|
-
|
164
|
+
# _get the return value
|
165
|
+
return_value = _get( k )
|
166
|
+
|
167
|
+
# unset and unprime if destructOnGet?
|
168
|
+
if destructOnGet?( k )
|
169
|
+
# puts "destructing #{k}"
|
170
|
+
unset( k )
|
171
|
+
unprime( k )
|
172
|
+
end
|
173
|
+
|
174
|
+
return return_value
|
149
175
|
end
|
150
176
|
|
177
|
+
|
151
178
|
# ==method: setCheap
|
152
179
|
#
|
153
180
|
# the expensive setter. key, value pairs stored via this method are not kept in memory
|
@@ -162,6 +189,58 @@ class Sadie
|
|
162
189
|
_primed( k, true )
|
163
190
|
end
|
164
191
|
|
192
|
+
# ==method: setDestructOnGet
|
193
|
+
#
|
194
|
+
# key value will go away and key will be unprimed and unset after next get
|
195
|
+
#
|
196
|
+
# NOTE: this doesn't make sense with keys that were set via setExpensive
|
197
|
+
# so it can be set, but nothing's going to happen differently
|
198
|
+
def setDestructOnGet( key, turnon=true )
|
199
|
+
# puts "setDestructOnGet( #{key}, #{turnon} )"
|
200
|
+
if ( turnon )
|
201
|
+
# puts "turning on destructOnGet for key: #{key}"
|
202
|
+
@flag_eachtimeprime["#{key}"] = true
|
203
|
+
return true
|
204
|
+
end
|
205
|
+
@flag_eachtimeprime.has_key?( key ) \
|
206
|
+
and @flag_eachtimeprime.delete( key )
|
207
|
+
end
|
208
|
+
|
209
|
+
# ==method: destructOnGet?
|
210
|
+
#
|
211
|
+
# returns true if the destructOnGet flag is set for the key
|
212
|
+
def destructOnGet?( key )
|
213
|
+
# print "destructOnGet?> key #{key} "
|
214
|
+
@flag_eachtimeprime.has_key?( key ) \
|
215
|
+
or return _newline( false )
|
216
|
+
# print " defined-in-eachtimeprime "
|
217
|
+
@flag_eachtimeprime["#{key}"] \
|
218
|
+
and return _newline( true )
|
219
|
+
# print " defined-but-false "
|
220
|
+
return _newline(false)
|
221
|
+
end
|
222
|
+
|
223
|
+
def _newline( rval=true )
|
224
|
+
#puts
|
225
|
+
return rval
|
226
|
+
end
|
227
|
+
|
228
|
+
# ==method: unset
|
229
|
+
# unsets the value of k. Note that this does not unprime, so
|
230
|
+
# get(key) will simply return nil. Run with unprime to have the
|
231
|
+
# primer run again
|
232
|
+
def unset( key )
|
233
|
+
_unset( key )
|
234
|
+
end
|
235
|
+
|
236
|
+
# ==method: unprime
|
237
|
+
# unprimes k. Note that this does not unset the value, so
|
238
|
+
# get(key) will continue to return whatever it otherwise would have.
|
239
|
+
# run unset as well to have the primer run again.
|
240
|
+
def unprime( key )
|
241
|
+
_primed( key, false )
|
242
|
+
end
|
243
|
+
|
165
244
|
# ==method: set
|
166
245
|
# alias for setCheap(k,v)
|
167
246
|
def set( k, v )
|
@@ -171,7 +250,7 @@ class Sadie
|
|
171
250
|
# ==method: setCheap
|
172
251
|
#
|
173
252
|
# the cheap setter. key, value pairs stored via this method are kept in memory
|
174
|
-
def setCheap(k,v)
|
253
|
+
def setCheap( k, v )
|
175
254
|
|
176
255
|
# set it, mark not expensive and primed
|
177
256
|
_set( k, v )
|
@@ -217,7 +296,9 @@ class Sadie
|
|
217
296
|
# INTERNAL: this method should only be called the the class method, Prime
|
218
297
|
#
|
219
298
|
def primed?( k )
|
220
|
-
@flag_primed
|
299
|
+
@flag_primed.has_key?( k ) \
|
300
|
+
or return false
|
301
|
+
@flag_primed["#{k}"] \
|
221
302
|
and return true
|
222
303
|
return false
|
223
304
|
end
|
@@ -227,7 +308,8 @@ class Sadie
|
|
227
308
|
# INTERNAL: this method should only be called the the class method, Prime
|
228
309
|
#
|
229
310
|
def expensive?( k )
|
230
|
-
@flag_expensive
|
311
|
+
@flag_expensive.has_key?( k ) or return false;
|
312
|
+
@flag_expensive["#{k}"] \
|
231
313
|
and return true
|
232
314
|
return false
|
233
315
|
end
|
@@ -238,12 +320,22 @@ class Sadie
|
|
238
320
|
|
239
321
|
|
240
322
|
def _prime ( k )
|
323
|
+
# puts "_prime( #{k} )"
|
324
|
+
# fetch primers dirpath and validate the primer hash
|
241
325
|
primer_dirpath = _get("sadie.primers_dirpath")
|
242
|
-
|
326
|
+
@@primer_hash.has_key?(primer_dirpath) \
|
327
|
+
or @@primer_hash[primer_dirpath] = Hash.new
|
328
|
+
|
329
|
+
primers = @@primer_hash[primer_dirpath]
|
330
|
+
primers.has_key?( k ) or return true
|
331
|
+
|
332
|
+
if primer_filepath = primers[k]
|
333
|
+
# puts "loading filepath: #{primer_filepath}"
|
243
334
|
Sadie::_setCurrentPrimerFilepath(primer_filepath)
|
244
335
|
Sadie::_setCurrentSadieInstance( self )
|
245
336
|
load primer_filepath
|
246
337
|
end
|
338
|
+
return true
|
247
339
|
|
248
340
|
end
|
249
341
|
|
@@ -344,7 +436,7 @@ class Sadie
|
|
344
436
|
|
345
437
|
def _primed( k, isprimed )
|
346
438
|
if isprimed
|
347
|
-
@flag_primed[
|
439
|
+
@flag_primed["#{k}"] = true
|
348
440
|
return
|
349
441
|
end
|
350
442
|
@flag_primed.delete( k )
|
@@ -352,7 +444,7 @@ class Sadie
|
|
352
444
|
|
353
445
|
def _expensive( k, isexpensive )
|
354
446
|
if isexpensive
|
355
|
-
@flag_expensive[
|
447
|
+
@flag_expensive["#{k}"] = true
|
356
448
|
return
|
357
449
|
end
|
358
450
|
@flag_expensive.delete( k )
|
@@ -360,7 +452,7 @@ class Sadie
|
|
360
452
|
|
361
453
|
# direct access getter for shortterm memory
|
362
454
|
def _get( key )
|
363
|
-
value = @shortterm[
|
455
|
+
value = @shortterm["#{key}"]
|
364
456
|
#puts "_get(#{key})> #{value}"
|
365
457
|
return value
|
366
458
|
end
|
@@ -369,7 +461,16 @@ class Sadie
|
|
369
461
|
def _set( key, value )
|
370
462
|
|
371
463
|
# puts "_set> key: #{key}, value: #{value}"
|
372
|
-
@shortterm[
|
464
|
+
@shortterm["#{key}"] = value
|
465
|
+
end
|
466
|
+
|
467
|
+
def _unset( key )
|
468
|
+
@shortterm.has_key?( key ) \
|
469
|
+
and @shortterm.delete( key )
|
470
|
+
end
|
471
|
+
|
472
|
+
def _isset?( key )
|
473
|
+
return @shortterm.has_key?( key )
|
373
474
|
end
|
374
475
|
|
375
476
|
# init given path to session file
|
@@ -429,7 +530,7 @@ class Sadie
|
|
429
530
|
|
430
531
|
def self._memorizePrimerLocation( filepath, primer_provides )
|
431
532
|
primer_dirpath = @@mid_primer_toplevel_primer_dirpath
|
432
|
-
@@primer_hash.has_key?(primer_dirpath) \
|
533
|
+
@@primer_hash.has_key?( primer_dirpath ) \
|
433
534
|
or @@primer_hash["#{primer_dirpath}"] = Hash.new
|
434
535
|
primer_provides.each do | key |
|
435
536
|
Sadie::_setPrimerProvider( key, filepath )
|
data/rdoc/classes/Sadie.html
CHANGED
@@ -103,14 +103,21 @@ the sadie constructor
|
|
103
103
|
|
104
104
|
<div class="name-list">
|
105
105
|
<a href="#M000003">Prime</a>
|
106
|
+
<a href="#M000008">_newline</a>
|
107
|
+
<a href="#M000007">destructOnGet?</a>
|
108
|
+
<a href="#M000016">expensive?</a>
|
106
109
|
<a href="#M000004">get</a>
|
107
110
|
<a href="#M000002">getSadieInstance</a>
|
108
111
|
<a href="#M000001">new</a>
|
109
|
-
<a href="#
|
110
|
-
<a href="#
|
111
|
-
<a href="#
|
112
|
-
<a href="#
|
112
|
+
<a href="#M000015">primed?</a>
|
113
|
+
<a href="#M000014">revert!</a>
|
114
|
+
<a href="#M000013">save</a>
|
115
|
+
<a href="#M000011">set</a>
|
116
|
+
<a href="#M000012">setCheap</a>
|
117
|
+
<a href="#M000006">setDestructOnGet</a>
|
113
118
|
<a href="#M000005">setExpensive</a>
|
119
|
+
<a href="#M000010">unprime</a>
|
120
|
+
<a href="#M000009">unset</a>
|
114
121
|
</div>
|
115
122
|
</div>
|
116
123
|
|
@@ -130,7 +137,7 @@ the sadie constructor
|
|
130
137
|
<tr class="top-aligned-row context-row">
|
131
138
|
<td class="context-item-name">VERSION</td>
|
132
139
|
<td>=</td>
|
133
|
-
<td class="context-item-value">"0.0.
|
140
|
+
<td class="context-item-value">"0.0.7"</td>
|
134
141
|
</tr>
|
135
142
|
<tr class="top-aligned-row context-row">
|
136
143
|
<td class="context-item-name">DEFAULTS</td>
|
@@ -173,7 +180,7 @@ resource (.res) file will have provided after the block is evaluated
|
|
173
180
|
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
174
181
|
<div class="method-source-code" id="M000003-source">
|
175
182
|
<pre>
|
176
|
-
<span class="ruby-comment cmt"># File lib/sadie.rb, line
|
183
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 96</span>
|
177
184
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-constant">Prime</span> ( <span class="ruby-identifier">primer_definition</span> )
|
178
185
|
|
179
186
|
<span class="ruby-comment cmt"># validate params</span>
|
@@ -187,14 +194,25 @@ resource (.res) file will have provided after the block is evaluated
|
|
187
194
|
<span class="ruby-comment cmt"># if initializing primers, just remember how to get back to the primer later,</span>
|
188
195
|
<span class="ruby-comment cmt"># otherwise, prime</span>
|
189
196
|
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">Sadie</span><span class="ruby-operator">::</span><span class="ruby-identifier">_midPrimerInit?</span>
|
197
|
+
|
198
|
+
<span class="ruby-comment cmt"># mid primer init, just memorize primer location</span>
|
190
199
|
<span class="ruby-constant">Sadie</span><span class="ruby-operator">::</span><span class="ruby-identifier">_memorizePrimerLocation</span>( <span class="ruby-ivar">@@mid_primer_filepath</span>, <span class="ruby-identifier">primer_definition</span>[<span class="ruby-value str">"provides"</span>] )
|
191
200
|
<span class="ruby-keyword kw">else</span>
|
201
|
+
|
202
|
+
<span class="ruby-comment cmt"># run code block with the current sadie instance</span>
|
192
203
|
<span class="ruby-identifier">current_sadie_instance</span> = <span class="ruby-constant">Sadie</span><span class="ruby-operator">::</span><span class="ruby-identifier">_getCurrentSadieInstance</span>
|
193
|
-
<span class="ruby-identifier">current_primer_filepath</span> = <span class="ruby-constant">Sadie</span><span class="ruby-operator">::</span><span class="ruby-identifier">_getCurrentPrimerFilepath</span>
|
194
204
|
<span class="ruby-keyword kw">yield</span>( <span class="ruby-identifier">current_sadie_instance</span> )
|
205
|
+
|
206
|
+
<span class="ruby-comment cmt"># loop thru all primer provides, ensuring each primed</span>
|
207
|
+
<span class="ruby-identifier">current_primer_filepath</span> = <span class="ruby-constant">Sadie</span><span class="ruby-operator">::</span><span class="ruby-identifier">_getCurrentPrimerFilepath</span>
|
195
208
|
<span class="ruby-identifier">primer_definition</span>[<span class="ruby-value str">"provides"</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">|</span>
|
209
|
+
|
210
|
+
<span class="ruby-comment cmt"># skip blank lines</span>
|
196
211
|
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">match</span> <span class="ruby-regexp re">/^\s*$/</span>
|
212
|
+
|
197
213
|
<span class="ruby-comment cmt">#puts "Prime> providing: #{key}"</span>
|
214
|
+
|
215
|
+
<span class="ruby-comment cmt"># key primed or raise error</span>
|
198
216
|
<span class="ruby-identifier">current_sadie_instance</span>.<span class="ruby-identifier">primed?</span> <span class="ruby-identifier">key</span> \
|
199
217
|
<span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-node">"primer definition file: #{current_primer_filepath} was supposed to define #{key}, but did not"</span>
|
200
218
|
<span class="ruby-keyword kw">end</span>
|
@@ -225,7 +243,7 @@ href="Sadie.html">Sadie</a>‘s constructor method
|
|
225
243
|
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
226
244
|
<div class="method-source-code" id="M000002-source">
|
227
245
|
<pre>
|
228
|
-
<span class="ruby-comment cmt"># File lib/sadie.rb, line
|
246
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 84</span>
|
229
247
|
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">getSadieInstance</span>( <span class="ruby-identifier">options</span> )
|
230
248
|
<span class="ruby-constant">Sadie</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>)
|
231
249
|
<span class="ruby-keyword kw">end</span>
|
@@ -270,6 +288,7 @@ href="Sadie.html">Sadie</a>‘s constructor method
|
|
270
288
|
<span class="ruby-ivar">@shortterm</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
271
289
|
<span class="ruby-ivar">@flag_expensive</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
272
290
|
<span class="ruby-ivar">@flag_primed</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
291
|
+
<span class="ruby-ivar">@flag_eachtimeprime</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
273
292
|
|
274
293
|
<span class="ruby-comment cmt"># init class</span>
|
275
294
|
<span class="ruby-constant">Sadie</span><span class="ruby-operator">::</span><span class="ruby-identifier">_checkSanity</span>
|
@@ -314,6 +333,95 @@ href="Sadie.html">Sadie</a>‘s constructor method
|
|
314
333
|
|
315
334
|
<h3 class="section-bar">Public Instance methods</h3>
|
316
335
|
|
336
|
+
<div id="method-M000008" class="method-detail">
|
337
|
+
<a name="M000008"></a>
|
338
|
+
|
339
|
+
<div class="method-heading">
|
340
|
+
<a href="#M000008" class="method-signature">
|
341
|
+
<span class="method-name">_newline</span><span class="method-args">( rval=true )</span>
|
342
|
+
</a>
|
343
|
+
</div>
|
344
|
+
|
345
|
+
<div class="method-description">
|
346
|
+
<p><a class="source-toggle" href="#"
|
347
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
348
|
+
<div class="method-source-code" id="M000008-source">
|
349
|
+
<pre>
|
350
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 223</span>
|
351
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_newline</span>( <span class="ruby-identifier">rval</span>=<span class="ruby-keyword kw">true</span> )
|
352
|
+
<span class="ruby-comment cmt">#puts</span>
|
353
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rval</span>
|
354
|
+
<span class="ruby-keyword kw">end</span>
|
355
|
+
</pre>
|
356
|
+
</div>
|
357
|
+
</div>
|
358
|
+
</div>
|
359
|
+
|
360
|
+
<div id="method-M000007" class="method-detail">
|
361
|
+
<a name="M000007"></a>
|
362
|
+
|
363
|
+
<div class="method-heading">
|
364
|
+
<a href="#M000007" class="method-signature">
|
365
|
+
<span class="method-name">destructOnGet?</span><span class="method-args">( key )</span>
|
366
|
+
</a>
|
367
|
+
</div>
|
368
|
+
|
369
|
+
<div class="method-description">
|
370
|
+
<h2>method: <a href="Sadie.html#M000007">destructOnGet?</a></h2>
|
371
|
+
<p>
|
372
|
+
returns true if the destructOnGet flag is <a
|
373
|
+
href="Sadie.html#M000011">set</a> for the key
|
374
|
+
</p>
|
375
|
+
<p><a class="source-toggle" href="#"
|
376
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
377
|
+
<div class="method-source-code" id="M000007-source">
|
378
|
+
<pre>
|
379
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 212</span>
|
380
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destructOnGet?</span>( <span class="ruby-identifier">key</span> )
|
381
|
+
<span class="ruby-comment cmt"># print "destructOnGet?> key #{key} "</span>
|
382
|
+
<span class="ruby-ivar">@flag_eachtimeprime</span>.<span class="ruby-identifier">has_key?</span>( <span class="ruby-identifier">key</span> ) \
|
383
|
+
<span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_newline</span>( <span class="ruby-keyword kw">false</span> )
|
384
|
+
<span class="ruby-comment cmt"># print " defined-in-eachtimeprime "</span>
|
385
|
+
<span class="ruby-ivar">@flag_eachtimeprime</span>[<span class="ruby-node">"#{key}"</span>] \
|
386
|
+
<span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_newline</span>( <span class="ruby-keyword kw">true</span> )
|
387
|
+
<span class="ruby-comment cmt"># print " defined-but-false "</span>
|
388
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_newline</span>(<span class="ruby-keyword kw">false</span>)
|
389
|
+
<span class="ruby-keyword kw">end</span>
|
390
|
+
</pre>
|
391
|
+
</div>
|
392
|
+
</div>
|
393
|
+
</div>
|
394
|
+
|
395
|
+
<div id="method-M000016" class="method-detail">
|
396
|
+
<a name="M000016"></a>
|
397
|
+
|
398
|
+
<div class="method-heading">
|
399
|
+
<a href="#M000016" class="method-signature">
|
400
|
+
<span class="method-name">expensive?</span><span class="method-args">( k )</span>
|
401
|
+
</a>
|
402
|
+
</div>
|
403
|
+
|
404
|
+
<div class="method-description">
|
405
|
+
<h2>method: <a href="Sadie.html#M000015">primed?</a></h2>
|
406
|
+
<pre>
|
407
|
+
INTERNAL: this method should only be called the the class method, Prime
|
408
|
+
</pre>
|
409
|
+
<p><a class="source-toggle" href="#"
|
410
|
+
onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
|
411
|
+
<div class="method-source-code" id="M000016-source">
|
412
|
+
<pre>
|
413
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 310</span>
|
414
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expensive?</span>( <span class="ruby-identifier">k</span> )
|
415
|
+
<span class="ruby-ivar">@flag_expensive</span>.<span class="ruby-identifier">has_key?</span>( <span class="ruby-identifier">k</span> ) <span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>;
|
416
|
+
<span class="ruby-ivar">@flag_expensive</span>[<span class="ruby-node">"#{k}"</span>] \
|
417
|
+
<span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
418
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
419
|
+
<span class="ruby-keyword kw">end</span>
|
420
|
+
</pre>
|
421
|
+
</div>
|
422
|
+
</div>
|
423
|
+
</div>
|
424
|
+
|
317
425
|
<div id="method-M000004" class="method-detail">
|
318
426
|
<a name="M000004"></a>
|
319
427
|
|
@@ -334,44 +442,100 @@ directed by the resource (.res) files
|
|
334
442
|
onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
|
335
443
|
<div class="method-source-code" id="M000004-source">
|
336
444
|
<pre>
|
337
|
-
<span class="ruby-comment cmt"># File lib/sadie.rb, line
|
445
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 138</span>
|
338
446
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get</span>( <span class="ruby-identifier">k</span> )
|
339
447
|
|
448
|
+
<span class="ruby-comment cmt"># if it's already set, return known answer</span>
|
449
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">_isset?</span>( <span class="ruby-identifier">k</span> )
|
450
|
+
|
451
|
+
<span class="ruby-comment cmt"># _get the return value</span>
|
452
|
+
<span class="ruby-identifier">return_value</span> = <span class="ruby-identifier">_get</span>( <span class="ruby-identifier">k</span> )
|
453
|
+
|
454
|
+
<span class="ruby-comment cmt"># unset and unprime if destructOnGet?</span>
|
455
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destructOnGet?</span>( <span class="ruby-identifier">k</span> )
|
456
|
+
<span class="ruby-comment cmt"># puts "destructing #{k}"</span>
|
457
|
+
<span class="ruby-identifier">unset</span>( <span class="ruby-identifier">k</span> )
|
458
|
+
<span class="ruby-identifier">unprime</span>( <span class="ruby-identifier">k</span> )
|
459
|
+
<span class="ruby-keyword kw">end</span>
|
460
|
+
|
461
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">return_value</span>
|
462
|
+
<span class="ruby-keyword kw">end</span>
|
463
|
+
|
340
464
|
<span class="ruby-comment cmt"># prime if not yet primed</span>
|
341
465
|
<span class="ruby-identifier">primed?</span>( <span class="ruby-identifier">k</span> ) \
|
342
466
|
<span class="ruby-keyword kw">or</span> <span class="ruby-identifier">_prime</span>( <span class="ruby-identifier">k</span> )
|
343
467
|
|
344
468
|
<span class="ruby-comment cmt"># if not expensive, then return what's already known</span>
|
345
469
|
<span class="ruby-identifier">expensive?</span>( <span class="ruby-identifier">k</span> ) \
|
346
|
-
<span class="ruby-keyword kw">
|
470
|
+
<span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_recallExpensive</span>( <span class="ruby-identifier">k</span> )
|
347
471
|
|
348
|
-
<span class="ruby-comment cmt">#
|
349
|
-
<span class="ruby-
|
472
|
+
<span class="ruby-comment cmt"># _get the return value</span>
|
473
|
+
<span class="ruby-identifier">return_value</span> = <span class="ruby-identifier">_get</span>( <span class="ruby-identifier">k</span> )
|
474
|
+
|
475
|
+
<span class="ruby-comment cmt"># unset and unprime if destructOnGet?</span>
|
476
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destructOnGet?</span>( <span class="ruby-identifier">k</span> )
|
477
|
+
<span class="ruby-comment cmt"># puts "destructing #{k}"</span>
|
478
|
+
<span class="ruby-identifier">unset</span>( <span class="ruby-identifier">k</span> )
|
479
|
+
<span class="ruby-identifier">unprime</span>( <span class="ruby-identifier">k</span> )
|
480
|
+
<span class="ruby-keyword kw">end</span>
|
481
|
+
|
482
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">return_value</span>
|
350
483
|
<span class="ruby-keyword kw">end</span>
|
351
484
|
</pre>
|
352
485
|
</div>
|
353
486
|
</div>
|
354
487
|
</div>
|
355
488
|
|
356
|
-
<div id="method-
|
357
|
-
<a name="
|
489
|
+
<div id="method-M000015" class="method-detail">
|
490
|
+
<a name="M000015"></a>
|
358
491
|
|
359
492
|
<div class="method-heading">
|
360
|
-
<a href="#
|
493
|
+
<a href="#M000015" class="method-signature">
|
494
|
+
<span class="method-name">primed?</span><span class="method-args">( k )</span>
|
495
|
+
</a>
|
496
|
+
</div>
|
497
|
+
|
498
|
+
<div class="method-description">
|
499
|
+
<h2>method: <a href="Sadie.html#M000015">primed?</a></h2>
|
500
|
+
<pre>
|
501
|
+
INTERNAL: this method should only be called the the class method, Prime
|
502
|
+
</pre>
|
503
|
+
<p><a class="source-toggle" href="#"
|
504
|
+
onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
|
505
|
+
<div class="method-source-code" id="M000015-source">
|
506
|
+
<pre>
|
507
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 298</span>
|
508
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">primed?</span>( <span class="ruby-identifier">k</span> )
|
509
|
+
<span class="ruby-ivar">@flag_primed</span>.<span class="ruby-identifier">has_key?</span>( <span class="ruby-identifier">k</span> ) \
|
510
|
+
<span class="ruby-keyword kw">or</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
511
|
+
<span class="ruby-ivar">@flag_primed</span>[<span class="ruby-node">"#{k}"</span>] \
|
512
|
+
<span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
513
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
514
|
+
<span class="ruby-keyword kw">end</span>
|
515
|
+
</pre>
|
516
|
+
</div>
|
517
|
+
</div>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
<div id="method-M000014" class="method-detail">
|
521
|
+
<a name="M000014"></a>
|
522
|
+
|
523
|
+
<div class="method-heading">
|
524
|
+
<a href="#M000014" class="method-signature">
|
361
525
|
<span class="method-name">revert!</span><span class="method-args">()</span>
|
362
526
|
</a>
|
363
527
|
</div>
|
364
528
|
|
365
529
|
<div class="method-description">
|
366
|
-
<h2>method: <a href="Sadie.html#
|
530
|
+
<h2>method: <a href="Sadie.html#M000014">revert!</a></h2>
|
367
531
|
<p>
|
368
532
|
return to last saved state
|
369
533
|
</p>
|
370
534
|
<p><a class="source-toggle" href="#"
|
371
|
-
onclick="toggleCode('
|
372
|
-
<div class="method-source-code" id="
|
535
|
+
onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
|
536
|
+
<div class="method-source-code" id="M000014-source">
|
373
537
|
<pre>
|
374
|
-
<span class="ruby-comment cmt"># File lib/sadie.rb, line
|
538
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 284</span>
|
375
539
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">revert!</span>
|
376
540
|
|
377
541
|
<span class="ruby-ivar">@shortterm</span> = {
|
@@ -386,25 +550,25 @@ return to last saved state
|
|
386
550
|
</div>
|
387
551
|
</div>
|
388
552
|
|
389
|
-
<div id="method-
|
390
|
-
<a name="
|
553
|
+
<div id="method-M000013" class="method-detail">
|
554
|
+
<a name="M000013"></a>
|
391
555
|
|
392
556
|
<div class="method-heading">
|
393
|
-
<a href="#
|
557
|
+
<a href="#M000013" class="method-signature">
|
394
558
|
<span class="method-name">save</span><span class="method-args">()</span>
|
395
559
|
</a>
|
396
560
|
</div>
|
397
561
|
|
398
562
|
<div class="method-description">
|
399
|
-
<h2>method: <a href="Sadie.html#
|
563
|
+
<h2>method: <a href="Sadie.html#M000013">save</a></h2>
|
400
564
|
<p>
|
401
565
|
serialize to session file
|
402
566
|
</p>
|
403
567
|
<p><a class="source-toggle" href="#"
|
404
|
-
onclick="toggleCode('
|
405
|
-
<div class="method-source-code" id="
|
568
|
+
onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
|
569
|
+
<div class="method-source-code" id="M000013-source">
|
406
570
|
<pre>
|
407
|
-
<span class="ruby-comment cmt"># File lib/sadie.rb, line
|
571
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 272</span>
|
408
572
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">save</span>
|
409
573
|
<span class="ruby-identifier">session_filepath</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>( <span class="ruby-value str">"session."</span><span class="ruby-operator">+</span><span class="ruby-identifier">value</span>, <span class="ruby-identifier">get</span>( <span class="ruby-value str">"sadie.sessions_dirpath"</span> ) )
|
410
574
|
<span class="ruby-identifier">serialized_value</span> = <span class="ruby-constant">Marshal</span><span class="ruby-operator">::</span><span class="ruby-identifier">dump</span>( [ <span class="ruby-ivar">@shortterm</span>, <span class="ruby-ivar">@flag_primed</span>, <span class="ruby-ivar">@flag_expensive</span> ] )
|
@@ -417,25 +581,25 @@ serialize to session file
|
|
417
581
|
</div>
|
418
582
|
</div>
|
419
583
|
|
420
|
-
<div id="method-
|
421
|
-
<a name="
|
584
|
+
<div id="method-M000011" class="method-detail">
|
585
|
+
<a name="M000011"></a>
|
422
586
|
|
423
587
|
<div class="method-heading">
|
424
|
-
<a href="#
|
588
|
+
<a href="#M000011" class="method-signature">
|
425
589
|
<span class="method-name">set</span><span class="method-args">( k, v )</span>
|
426
590
|
</a>
|
427
591
|
</div>
|
428
592
|
|
429
593
|
<div class="method-description">
|
430
|
-
<h2>method: <a href="Sadie.html#
|
594
|
+
<h2>method: <a href="Sadie.html#M000011">set</a></h2>
|
431
595
|
<p>
|
432
|
-
alias for <a href="Sadie.html#
|
596
|
+
alias for <a href="Sadie.html#M000012">setCheap</a>(k,v)
|
433
597
|
</p>
|
434
598
|
<p><a class="source-toggle" href="#"
|
435
|
-
onclick="toggleCode('
|
436
|
-
<div class="method-source-code" id="
|
599
|
+
onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
|
600
|
+
<div class="method-source-code" id="M000011-source">
|
437
601
|
<pre>
|
438
|
-
<span class="ruby-comment cmt"># File lib/sadie.rb, line
|
602
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 246</span>
|
439
603
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>( <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span> )
|
440
604
|
<span class="ruby-identifier">setCheap</span>( <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span> )
|
441
605
|
<span class="ruby-keyword kw">end</span>
|
@@ -444,27 +608,27 @@ alias for <a href="Sadie.html#M000007">setCheap</a>(k,v)
|
|
444
608
|
</div>
|
445
609
|
</div>
|
446
610
|
|
447
|
-
<div id="method-
|
448
|
-
<a name="
|
611
|
+
<div id="method-M000012" class="method-detail">
|
612
|
+
<a name="M000012"></a>
|
449
613
|
|
450
614
|
<div class="method-heading">
|
451
|
-
<a href="#
|
452
|
-
<span class="method-name">setCheap</span><span class="method-args">(k,v)</span>
|
615
|
+
<a href="#M000012" class="method-signature">
|
616
|
+
<span class="method-name">setCheap</span><span class="method-args">( k, v )</span>
|
453
617
|
</a>
|
454
618
|
</div>
|
455
619
|
|
456
620
|
<div class="method-description">
|
457
|
-
<h2>method: <a href="Sadie.html#
|
621
|
+
<h2>method: <a href="Sadie.html#M000012">setCheap</a></h2>
|
458
622
|
<p>
|
459
623
|
the cheap setter. key, value pairs stored via this method are kept in
|
460
624
|
memory
|
461
625
|
</p>
|
462
626
|
<p><a class="source-toggle" href="#"
|
463
|
-
onclick="toggleCode('
|
464
|
-
<div class="method-source-code" id="
|
627
|
+
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
628
|
+
<div class="method-source-code" id="M000012-source">
|
465
629
|
<pre>
|
466
|
-
<span class="ruby-comment cmt"># File lib/sadie.rb, line
|
467
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setCheap</span>(<span class="ruby-identifier">k</span
|
630
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 253</span>
|
631
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setCheap</span>( <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span> )
|
468
632
|
|
469
633
|
<span class="ruby-comment cmt"># set it, mark not expensive and primed</span>
|
470
634
|
<span class="ruby-identifier">_set</span>( <span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span> )
|
@@ -484,6 +648,43 @@ memory
|
|
484
648
|
</div>
|
485
649
|
</div>
|
486
650
|
|
651
|
+
<div id="method-M000006" class="method-detail">
|
652
|
+
<a name="M000006"></a>
|
653
|
+
|
654
|
+
<div class="method-heading">
|
655
|
+
<a href="#M000006" class="method-signature">
|
656
|
+
<span class="method-name">setDestructOnGet</span><span class="method-args">( key, turnon=true )</span>
|
657
|
+
</a>
|
658
|
+
</div>
|
659
|
+
|
660
|
+
<div class="method-description">
|
661
|
+
<h2>method: <a href="Sadie.html#M000006">setDestructOnGet</a></h2>
|
662
|
+
<pre>
|
663
|
+
key value will go away and key will be unprimed and unset after next get
|
664
|
+
|
665
|
+
NOTE: this doesn't make sense with keys that were set via setExpensive
|
666
|
+
so it can be set, but nothing's going to happen differently
|
667
|
+
</pre>
|
668
|
+
<p><a class="source-toggle" href="#"
|
669
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
670
|
+
<div class="method-source-code" id="M000006-source">
|
671
|
+
<pre>
|
672
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 198</span>
|
673
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setDestructOnGet</span>( <span class="ruby-identifier">key</span>, <span class="ruby-identifier">turnon</span>=<span class="ruby-keyword kw">true</span> )
|
674
|
+
<span class="ruby-comment cmt"># puts "setDestructOnGet( #{key}, #{turnon} )"</span>
|
675
|
+
<span class="ruby-keyword kw">if</span> ( <span class="ruby-identifier">turnon</span> )
|
676
|
+
<span class="ruby-comment cmt"># puts "turning on destructOnGet for key: #{key}"</span>
|
677
|
+
<span class="ruby-ivar">@flag_eachtimeprime</span>[<span class="ruby-node">"#{key}"</span>] = <span class="ruby-keyword kw">true</span>
|
678
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
679
|
+
<span class="ruby-keyword kw">end</span>
|
680
|
+
<span class="ruby-ivar">@flag_eachtimeprime</span>.<span class="ruby-identifier">has_key?</span>( <span class="ruby-identifier">key</span> ) \
|
681
|
+
<span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@flag_eachtimeprime</span>.<span class="ruby-identifier">delete</span>( <span class="ruby-identifier">key</span> )
|
682
|
+
<span class="ruby-keyword kw">end</span>
|
683
|
+
</pre>
|
684
|
+
</div>
|
685
|
+
</div>
|
686
|
+
</div>
|
687
|
+
|
487
688
|
<div id="method-M000005" class="method-detail">
|
488
689
|
<a name="M000005"></a>
|
489
690
|
|
@@ -494,7 +695,7 @@ memory
|
|
494
695
|
</div>
|
495
696
|
|
496
697
|
<div class="method-description">
|
497
|
-
<h2>method: <a href="Sadie.html#
|
698
|
+
<h2>method: <a href="Sadie.html#M000012">setCheap</a></h2>
|
498
699
|
<p>
|
499
700
|
the expensive setter. key, value pairs stored via this method are not kept
|
500
701
|
in memory but are stored to file and recalled as needed
|
@@ -503,7 +704,7 @@ in memory but are stored to file and recalled as needed
|
|
503
704
|
onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
|
504
705
|
<div class="method-source-code" id="M000005-source">
|
505
706
|
<pre>
|
506
|
-
<span class="ruby-comment cmt"># File lib/sadie.rb, line
|
707
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 182</span>
|
507
708
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setExpensive</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)
|
508
709
|
<span class="ruby-identifier">expensive_filepath</span> = <span class="ruby-identifier">_computeExpensiveFilepath</span>( <span class="ruby-identifier">k</span> )
|
509
710
|
<span class="ruby-identifier">serialized_value</span> = <span class="ruby-constant">Marshal</span><span class="ruby-operator">::</span><span class="ruby-identifier">dump</span>( <span class="ruby-identifier">v</span> )
|
@@ -518,6 +719,66 @@ in memory but are stored to file and recalled as needed
|
|
518
719
|
</div>
|
519
720
|
</div>
|
520
721
|
|
722
|
+
<div id="method-M000010" class="method-detail">
|
723
|
+
<a name="M000010"></a>
|
724
|
+
|
725
|
+
<div class="method-heading">
|
726
|
+
<a href="#M000010" class="method-signature">
|
727
|
+
<span class="method-name">unprime</span><span class="method-args">( key )</span>
|
728
|
+
</a>
|
729
|
+
</div>
|
730
|
+
|
731
|
+
<div class="method-description">
|
732
|
+
<h2>method: <a href="Sadie.html#M000010">unprime</a></h2>
|
733
|
+
<p>
|
734
|
+
unprimes k. Note that this does not <a href="Sadie.html#M000009">unset</a>
|
735
|
+
the value, so <a href="Sadie.html#M000004">get</a>(key) will continue to
|
736
|
+
return whatever it otherwise would have. run <a
|
737
|
+
href="Sadie.html#M000009">unset</a> as well to have the primer run again.
|
738
|
+
</p>
|
739
|
+
<p><a class="source-toggle" href="#"
|
740
|
+
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
741
|
+
<div class="method-source-code" id="M000010-source">
|
742
|
+
<pre>
|
743
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 240</span>
|
744
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unprime</span>( <span class="ruby-identifier">key</span> )
|
745
|
+
<span class="ruby-identifier">_primed</span>( <span class="ruby-identifier">key</span>, <span class="ruby-keyword kw">false</span> )
|
746
|
+
<span class="ruby-keyword kw">end</span>
|
747
|
+
</pre>
|
748
|
+
</div>
|
749
|
+
</div>
|
750
|
+
</div>
|
751
|
+
|
752
|
+
<div id="method-M000009" class="method-detail">
|
753
|
+
<a name="M000009"></a>
|
754
|
+
|
755
|
+
<div class="method-heading">
|
756
|
+
<a href="#M000009" class="method-signature">
|
757
|
+
<span class="method-name">unset</span><span class="method-args">( key )</span>
|
758
|
+
</a>
|
759
|
+
</div>
|
760
|
+
|
761
|
+
<div class="method-description">
|
762
|
+
<h2>method: <a href="Sadie.html#M000009">unset</a></h2>
|
763
|
+
<p>
|
764
|
+
unsets the value of k. Note that this does not <a
|
765
|
+
href="Sadie.html#M000010">unprime</a>, so <a
|
766
|
+
href="Sadie.html#M000004">get</a>(key) will simply return nil. Run with <a
|
767
|
+
href="Sadie.html#M000010">unprime</a> to have the primer run again
|
768
|
+
</p>
|
769
|
+
<p><a class="source-toggle" href="#"
|
770
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
771
|
+
<div class="method-source-code" id="M000009-source">
|
772
|
+
<pre>
|
773
|
+
<span class="ruby-comment cmt"># File lib/sadie.rb, line 232</span>
|
774
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unset</span>( <span class="ruby-identifier">key</span> )
|
775
|
+
<span class="ruby-identifier">_unset</span>( <span class="ruby-identifier">key</span> )
|
776
|
+
<span class="ruby-keyword kw">end</span>
|
777
|
+
</pre>
|
778
|
+
</div>
|
779
|
+
</div>
|
780
|
+
</div>
|
781
|
+
|
521
782
|
|
522
783
|
</div>
|
523
784
|
|
data/rdoc/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
Fri, 20 Jan 2012 01:26:54 -0500
|
data/rdoc/fr_method_index.html
CHANGED
@@ -21,14 +21,21 @@
|
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
22
22
|
<div id="index-entries">
|
23
23
|
<a href="classes/Sadie.html#M000003">Prime (Sadie)</a><br />
|
24
|
+
<a href="classes/Sadie.html#M000008">_newline (Sadie)</a><br />
|
25
|
+
<a href="classes/Sadie.html#M000007">destructOnGet? (Sadie)</a><br />
|
26
|
+
<a href="classes/Sadie.html#M000016">expensive? (Sadie)</a><br />
|
24
27
|
<a href="classes/Sadie.html#M000004">get (Sadie)</a><br />
|
25
28
|
<a href="classes/Sadie.html#M000002">getSadieInstance (Sadie)</a><br />
|
26
29
|
<a href="classes/Sadie.html#M000001">new (Sadie)</a><br />
|
27
|
-
<a href="classes/Sadie.html#
|
28
|
-
<a href="classes/Sadie.html#
|
29
|
-
<a href="classes/Sadie.html#
|
30
|
-
<a href="classes/Sadie.html#
|
30
|
+
<a href="classes/Sadie.html#M000015">primed? (Sadie)</a><br />
|
31
|
+
<a href="classes/Sadie.html#M000014">revert! (Sadie)</a><br />
|
32
|
+
<a href="classes/Sadie.html#M000013">save (Sadie)</a><br />
|
33
|
+
<a href="classes/Sadie.html#M000011">set (Sadie)</a><br />
|
34
|
+
<a href="classes/Sadie.html#M000012">setCheap (Sadie)</a><br />
|
35
|
+
<a href="classes/Sadie.html#M000006">setDestructOnGet (Sadie)</a><br />
|
31
36
|
<a href="classes/Sadie.html#M000005">setExpensive (Sadie)</a><br />
|
37
|
+
<a href="classes/Sadie.html#M000010">unprime (Sadie)</a><br />
|
38
|
+
<a href="classes/Sadie.html#M000009">unset (Sadie)</a><br />
|
32
39
|
</div>
|
33
40
|
</div>
|
34
41
|
</body>
|
data/test/tc_sadie_toplevel.rb
CHANGED
@@ -16,6 +16,15 @@ class TestSadieToplevel < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
# test top-level res
|
18
18
|
assert_equal( sadie.get( "toplevel_single.oneprime" ), "primedit" )
|
19
|
+
|
20
|
+
# test destruct on get
|
21
|
+
dog1a = sadie.get( "toplevel_destructonget.oneprime" )
|
22
|
+
dog2a = sadie.get( "toplevel_destructonget.twoprime" )
|
23
|
+
dog2b = sadie.get( "toplevel_destructonget.twoprime" )
|
24
|
+
sleep( 2 )
|
25
|
+
dog1b = sadie.get( "toplevel_destructonget.oneprime" )
|
26
|
+
assert_equal( dog2a, dog2b )
|
27
|
+
assert_not_equal( dog1a, dog1b )
|
19
28
|
end
|
20
29
|
end
|
21
30
|
end
|
Binary file
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'sadie'
|
2
|
+
|
3
|
+
Sadie::Prime( "provides" => %w{ toplevel_destructonget.oneprime
|
4
|
+
toplevel_destructonget.twoprime } ) do |sadie|
|
5
|
+
puts "running destructonget primer..."
|
6
|
+
timeobj = Time.now
|
7
|
+
timeinsecs = timeobj.to_f
|
8
|
+
sadie.set( "toplevel_destructonget.oneprime", "primedthem - #{timeinsecs}" )
|
9
|
+
sadie.set( "toplevel_destructonget.twoprime", "primedthem" )
|
10
|
+
sadie.setDestructOnGet("toplevel_destructonget.oneprime")
|
11
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sadie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Fred McDavid
|
@@ -29,6 +29,7 @@ extra_rdoc_files: []
|
|
29
29
|
|
30
30
|
files:
|
31
31
|
- .gitignore
|
32
|
+
- CHANGELOG
|
32
33
|
- Gemfile
|
33
34
|
- LEGAL
|
34
35
|
- LICENSE
|
@@ -52,8 +53,10 @@ files:
|
|
52
53
|
- sadie.gemspec
|
53
54
|
- test/tc_sadie_toplevel.rb
|
54
55
|
- test/tc_sadie_twodeep.rb
|
56
|
+
- test/test_primers/.toplevel_double.res.rb.kate-swp
|
55
57
|
- test/test_primers/onedeep/multiresult.res
|
56
58
|
- test/test_primers/toplevel.ini
|
59
|
+
- test/test_primers/toplevel_destructonget.res.rb
|
57
60
|
- test/test_primers/toplevel_double.res.rb
|
58
61
|
- test/test_primers/toplevel_single.res.rb
|
59
62
|
- test/test_primers/two/deep/conf.ini
|