time_span 0.0.1.beta.01 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/Gemfile.lock +24 -0
- data/README.md +12 -3
- data/doc/TimeSpan/RelativeTime.html +646 -329
- data/doc/TimeSpan/TimeLine.html +1705 -542
- data/doc/TimeSpan/TimeSpan.html +2764 -889
- data/doc/TimeSpan.html +118 -142
- data/doc/_index.html +135 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +55 -0
- data/doc/css/style.css +322 -0
- data/doc/file.README.html +85 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +69 -124
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +173 -0
- data/doc/js/jquery.js +13 -29
- data/doc/method_list.html +462 -0
- data/doc/top-level-namespace.html +105 -0
- data/lib/time_span/version.rb +1 -1
- data/lib/time_span.rb +196 -72
- data/spec/time_span/time_span_spec.rb +12 -3
- metadata +21 -9
data/doc/TimeSpan/TimeLine.html
CHANGED
@@ -1,638 +1,1801 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
4
3
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
14
|
-
<script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
15
|
-
<script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
16
|
-
|
17
|
-
</head>
|
18
|
-
<body id="top" class="class">
|
19
|
-
|
20
|
-
<div id="metadata">
|
21
|
-
<div id="home-metadata">
|
22
|
-
<div id="home-section" class="section">
|
23
|
-
<h3 class="section-header">
|
24
|
-
<a href="../index.html">Home</a>
|
25
|
-
<a href="../index.html#classes">Classes</a>
|
26
|
-
<a href="../index.html#methods">Methods</a>
|
27
|
-
</h3>
|
28
|
-
</div>
|
29
|
-
</div>
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: TimeSpan::TimeLine
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.5
|
10
|
+
|
11
|
+
</title>
|
30
12
|
|
31
|
-
|
32
|
-
<div id="file-list-section" class="section">
|
33
|
-
<h3 class="section-header">In Files</h3>
|
34
|
-
<div class="section-body">
|
35
|
-
<ul>
|
36
|
-
|
37
|
-
<li><a href="../lib/time_span_rb.html?TB_iframe=true&height=550&width=785"
|
38
|
-
class="thickbox" title="lib/time_span.rb">lib/time_span.rb</a></li>
|
39
|
-
|
40
|
-
</ul>
|
41
|
-
</div>
|
42
|
-
</div>
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
|
43
14
|
|
44
|
-
|
45
|
-
</div>
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
|
46
16
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
<h3 class="section-header">Parent</h3>
|
52
|
-
|
53
|
-
<p class="link">Array</p>
|
54
|
-
|
55
|
-
</div>
|
56
|
-
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '..';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
57
21
|
|
58
|
-
|
22
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
59
23
|
|
60
|
-
|
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 (T)</a> »
|
37
|
+
<span class='title'><span class='object_link'><a href="../TimeSpan.html" title="TimeSpan (module)">TimeSpan</a></span></span>
|
38
|
+
»
|
39
|
+
<span class="title">TimeLine</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Class: TimeSpan::TimeLine
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
61
64
|
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
<dt class="r1">Inherits:</dt>
|
68
|
+
<dd class="r1">
|
69
|
+
<span class="inheritName">Array</span>
|
62
70
|
|
63
|
-
|
64
|
-
|
65
|
-
<h3 class="section-header">Methods</h3>
|
66
|
-
<ul class="link-list">
|
67
|
-
|
68
|
-
<li><a href="#method-c-new">::new</a></li>
|
71
|
+
<ul class="fullTree">
|
72
|
+
<li>Object</li>
|
69
73
|
|
70
|
-
|
74
|
+
<li class="next">Array</li>
|
71
75
|
|
72
|
-
|
73
|
-
|
74
|
-
<li><a href="#method-i-compress-21">#compress!</a></li>
|
75
|
-
|
76
|
-
<li><a href="#method-i-increase_after">#increase_after</a></li>
|
77
|
-
|
78
|
-
<li><a href="#method-i-insert_at">#insert_at</a></li>
|
79
|
-
|
80
|
-
<li><a href="#method-i-insert_before_next">#insert_before_next</a></li>
|
81
|
-
|
82
|
-
<li><a href="#method-i-position_of">#position_of</a></li>
|
83
|
-
|
84
|
-
<li><a href="#method-i-remove">#remove</a></li>
|
85
|
-
|
86
|
-
<li><a href="#method-i-to_s">#to_s</a></li>
|
76
|
+
<li class="next">TimeSpan::TimeLine</li>
|
87
77
|
|
88
78
|
</ul>
|
89
|
-
|
79
|
+
<a href="#" class="inheritanceTree">show all</a>
|
90
80
|
|
81
|
+
</dd>
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<dt class="r2 last">Defined in:</dt>
|
92
|
+
<dd class="r2 last">lib/time_span.rb</dd>
|
93
|
+
|
94
|
+
</dl>
|
95
|
+
<div class="clear"></div>
|
91
96
|
|
92
|
-
|
93
|
-
|
97
|
+
<h2>Overview</h2><div class="docstring">
|
98
|
+
<div class="discussion">
|
99
|
+
|
100
|
+
<p>class TimeLine
|
101
|
+
#</p>
|
102
|
+
|
103
|
+
<pre class="code ruby"><code> #
|
104
|
+
TimeLine is how RelativeTime objects are related to each other, they have to have the same #
|
105
|
+
frame of reference. #
|
106
|
+
#
|
107
|
+
instance methods: #
|
108
|
+
#
|
109
|
+
to_s -- convenience method to see which object we have #
|
110
|
+
position_of(obj) -- its location on the TimeLine #
|
111
|
+
increase_after(position, amount) -- make room in the index for an insertion #
|
112
|
+
append (obj) -- add obj to end of the TimeLine #
|
113
|
+
append_to_next(relative_object, object, relative) at relative offset to relative_object, put obj #
|
114
|
+
insert_before_next(relative_object, object, relative) inserts into new time slot relative to relative_object
|
115
|
+
insert_at(position, object) -- places object at position, appending if equal time exists #
|
116
|
+
remove(obj) -- remove object from the TimeLine #
|
117
|
+
compress! -- compresses the TimeLine, removing [] and adjusting the index accordingly #
|
118
|
+
#</code></pre>
|
94
119
|
|
95
|
-
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
<div class="tags">
|
124
|
+
|
125
|
+
<h3>Author:</h3>
|
126
|
+
<ul class="author">
|
127
|
+
|
128
|
+
<li>
|
96
129
|
|
97
130
|
|
98
|
-
<div id="fileindex-section" class="section project-section">
|
99
|
-
<h3 class="section-header">Files</h3>
|
100
|
-
<ul>
|
101
|
-
|
102
|
-
<li class="file"><a href="../Gemfile.html">Gemfile</a></li>
|
103
|
-
|
104
|
-
<li class="file"><a href="../Rakefile.html">Rakefile</a></li>
|
105
|
-
|
106
|
-
</ul>
|
107
|
-
</div>
|
108
|
-
|
109
|
-
|
110
|
-
<div id="classindex-section" class="section project-section">
|
111
|
-
<h3 class="section-header">Class/Module Index
|
112
|
-
<span class="search-toggle"><img src="../images/find.png"
|
113
|
-
height="16" width="16" alt="[+]"
|
114
|
-
title="show/hide quicksearch" /></span></h3>
|
115
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
116
|
-
<fieldset>
|
117
|
-
<legend>Quicksearch</legend>
|
118
|
-
<input type="text" name="quicksearch" value=""
|
119
|
-
class="quicksearch-field" />
|
120
|
-
</fieldset>
|
121
|
-
</form>
|
122
|
-
|
123
|
-
<ul class="link-list">
|
124
|
-
|
125
|
-
<li><a href="../TimeSpan.html">TimeSpan</a></li>
|
126
|
-
|
127
|
-
<li><a href="../TimeSpan/RelativeTime.html">TimeSpan::RelativeTime</a></li>
|
128
|
-
|
129
|
-
<li><a href="../TimeSpan/TimeLine.html">TimeSpan::TimeLine</a></li>
|
130
|
-
|
131
|
-
<li><a href="../TimeSpan/TimeSpan.html">TimeSpan::TimeSpan</a></li>
|
132
|
-
|
133
|
-
</ul>
|
134
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
135
|
-
</div>
|
136
|
-
|
137
131
|
|
138
|
-
</div>
|
139
|
-
</div>
|
140
|
-
|
141
|
-
<div id="documentation">
|
142
|
-
<h1 class="class">TimeSpan::TimeLine</h1>
|
143
|
-
|
144
|
-
<div id="description" class="description">
|
145
132
|
|
146
|
-
|
147
|
-
|
133
|
+
|
134
|
+
<div class='inline'>
|
135
|
+
<p>Craig A. .Cook</p>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
</li>
|
139
|
+
|
140
|
+
</ul>
|
148
141
|
|
149
|
-
|
142
|
+
</div>
|
150
143
|
|
151
|
-
<p><a href="TimeLine.html">TimeLine</a> is how <a
|
152
|
-
href="RelativeTime.html">RelativeTime</a> objects are related to each
|
153
|
-
other, they have to have the same #</p>
|
154
144
|
|
155
|
-
<pre>frame of reference. #
|
156
|
-
#</pre>
|
157
145
|
|
158
|
-
<
|
159
|
-
|
146
|
+
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
147
|
+
<ul class="summary">
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#indices_of-instance_method" title="#indices_of (instance method)">- (Object) <strong>indices_of</strong> </a>
|
153
|
+
|
160
154
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
172
166
|
|
173
|
-
|
167
|
+
|
168
|
+
<span class="summary_desc"><div class='inline'>
|
169
|
+
<p>Returns the value of attribute indices_of.</p>
|
170
|
+
</div></span>
|
171
|
+
|
172
|
+
</li>
|
174
173
|
|
175
174
|
|
175
|
+
<li class="public ">
|
176
|
+
<span class="summary_signature">
|
176
177
|
|
178
|
+
<a href="#line-instance_method" title="#line (instance method)">- (Object) <strong>line</strong> </a>
|
177
179
|
|
178
|
-
<div id="5Buntitled-5D" class="documentation-section">
|
179
|
-
|
180
180
|
|
181
|
-
|
181
|
+
|
182
|
+
</span>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
182
192
|
|
183
|
-
|
193
|
+
|
194
|
+
<span class="summary_desc"><div class='inline'>
|
195
|
+
<p>Returns the value of attribute line.</p>
|
196
|
+
</div></span>
|
197
|
+
|
198
|
+
</li>
|
184
199
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
200
|
+
|
201
|
+
<li class="public ">
|
202
|
+
<span class="summary_signature">
|
203
|
+
|
204
|
+
<a href="#name-instance_method" title="#name (instance method)">- (Object) <strong>name</strong> </a>
|
205
|
+
|
189
206
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
207
|
+
|
208
|
+
</span>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
200
218
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
<div id="line-attribute-method" class="method-detail">
|
209
|
-
<a name="line"></a>
|
210
|
-
|
211
|
-
<a name="line="></a>
|
212
|
-
|
213
|
-
<div class="method-heading attribute-method-heading">
|
214
|
-
<span class="method-name">line</span><span
|
215
|
-
class="attribute-access-type">[RW]</span>
|
216
|
-
</div>
|
219
|
+
|
220
|
+
<span class="summary_desc"><div class='inline'>
|
221
|
+
<p>Returns the value of attribute name.</p>
|
222
|
+
</div></span>
|
223
|
+
|
224
|
+
</li>
|
217
225
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
<div id="name-attribute-method" class="method-detail">
|
226
|
-
<a name="name"></a>
|
227
|
-
|
228
|
-
<a name="name="></a>
|
229
|
-
|
230
|
-
<div class="method-heading attribute-method-heading">
|
231
|
-
<span class="method-name">name</span><span
|
232
|
-
class="attribute-access-type">[RW]</span>
|
233
|
-
</div>
|
226
|
+
|
227
|
+
<li class="public ">
|
228
|
+
<span class="summary_signature">
|
229
|
+
|
230
|
+
<a href="#spans-instance_method" title="#spans (instance method)">- (Object) <strong>spans</strong> </a>
|
231
|
+
|
234
232
|
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
233
|
+
|
234
|
+
</span>
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
244
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
245
|
+
|
246
|
+
<span class="summary_desc"><div class='inline'>
|
247
|
+
<p>Returns the value of attribute spans.</p>
|
248
|
+
</div></span>
|
249
|
+
|
250
|
+
</li>
|
249
251
|
|
250
|
-
|
251
|
-
|
252
|
-
<a name="method-c-new"></a>
|
252
|
+
|
253
|
+
</ul>
|
253
254
|
|
254
|
-
|
255
|
-
<div class="method-heading">
|
256
|
-
<span class="method-name">new</span><span
|
257
|
-
class="method-args">(name="")</span>
|
258
|
-
<span class="method-click-advice">click to toggle source</span>
|
259
|
-
</div>
|
260
|
-
|
261
255
|
|
262
|
-
<div class="method-description">
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
<div class="method-source-code" id="new-source">
|
269
|
-
<pre>
|
270
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 156</span>
|
271
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>=<span class="ruby-string">""</span>)
|
272
|
-
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
|
273
|
-
<span class="ruby-ivar">@line</span> = []
|
274
|
-
<span class="ruby-ivar">@indices_of</span> = {}
|
275
|
-
<span class="ruby-keyword">end</span></pre>
|
276
|
-
</div><!-- new-source -->
|
277
|
-
|
278
|
-
</div>
|
279
256
|
|
280
|
-
|
281
257
|
|
282
|
-
|
283
|
-
|
258
|
+
|
259
|
+
<h2>
|
260
|
+
Instance Method Summary
|
261
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
262
|
+
</h2>
|
284
263
|
|
264
|
+
<ul class="summary">
|
285
265
|
|
286
|
-
|
266
|
+
<li class="public ">
|
267
|
+
<span class="summary_signature">
|
268
|
+
|
269
|
+
<a href="#all_endpoint_statuses-instance_method" title="#all_endpoint_statuses (instance method)">- (Array) <strong>all_endpoint_statuses</strong> </a>
|
287
270
|
|
288
|
-
<div id="public-instance-method-details" class="method-section section">
|
289
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
290
|
-
|
291
|
-
|
292
|
-
<div id="append-method" class="method-detail ">
|
293
|
-
<a name="method-i-append"></a>
|
294
|
-
|
295
|
-
|
296
|
-
<div class="method-heading">
|
297
|
-
<span class="method-name">append</span><span
|
298
|
-
class="method-args">(obj)</span>
|
299
|
-
<span class="method-click-advice">click to toggle source</span>
|
300
|
-
</div>
|
301
|
-
|
302
|
-
|
303
|
-
<div class="method-description">
|
304
|
-
|
305
|
-
<p>add to the end of the <a href="TimeLine.html">TimeLine</a></p>
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
<div class="method-source-code" id="append-source">
|
310
|
-
<pre>
|
311
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 177</span>
|
312
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">append</span>(<span class="ruby-identifier">obj</span>)
|
313
|
-
<span class="ruby-identifier">insert_at</span>(<span class="ruby-ivar">@line</span>.<span class="ruby-identifier">size</span>, <span class="ruby-identifier">obj</span>)
|
314
|
-
<span class="ruby-keyword">end</span></pre>
|
315
|
-
</div><!-- append-source -->
|
316
|
-
|
317
|
-
</div>
|
318
271
|
|
319
|
-
|
272
|
+
|
273
|
+
</span>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
|
320
280
|
|
321
|
-
|
322
|
-
|
281
|
+
|
282
|
+
<span class="summary_desc"><div class='inline'>
|
283
|
+
<p>Endpoint statuses for all TimeSpan s on the TimeLine.</p>
|
284
|
+
</div></span>
|
285
|
+
|
286
|
+
</li>
|
323
287
|
|
324
288
|
|
325
|
-
<
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
<span class="method-name">append_to_next</span><span
|
331
|
-
class="method-args">(relative_obj, obj, relative=1)</span>
|
332
|
-
<span class="method-click-advice">click to toggle source</span>
|
333
|
-
</div>
|
334
|
-
|
335
|
-
|
336
|
-
<div class="method-description">
|
337
|
-
|
338
|
-
<p>inserts to the end of the relative object’s time, becoming equal with it</p>
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
<div class="method-source-code" id="append_to_next-source">
|
343
|
-
<pre>
|
344
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 182</span>
|
345
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">append_to_next</span>(<span class="ruby-identifier">relative_obj</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">relative</span>=<span class="ruby-value">1</span>)
|
346
|
-
<span class="ruby-identifier">insert_at</span>(<span class="ruby-identifier">position_of</span>(<span class="ruby-identifier">relative_obj</span>)<span class="ruby-operator">+</span><span class="ruby-identifier">relative</span>, <span class="ruby-identifier">obj</span>)
|
347
|
-
<span class="ruby-keyword">end</span></pre>
|
348
|
-
</div><!-- append_to_next-source -->
|
349
|
-
|
350
|
-
</div>
|
289
|
+
<li class="public ">
|
290
|
+
<span class="summary_signature">
|
291
|
+
|
292
|
+
<a href="#all_relative_time_statuses-instance_method" title="#all_relative_time_statuses (instance method)">- (Array) <strong>all_relative_time_statuses</strong> </a>
|
293
|
+
|
351
294
|
|
352
|
-
|
295
|
+
|
296
|
+
</span>
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
353
303
|
|
354
|
-
|
355
|
-
|
304
|
+
|
305
|
+
<span class="summary_desc"><div class='inline'>
|
306
|
+
<p>all statuses on the TimeLine.</p>
|
307
|
+
</div></span>
|
308
|
+
|
309
|
+
</li>
|
356
310
|
|
357
311
|
|
358
|
-
<
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
<span class="method-name">compress!</span><span
|
364
|
-
class="method-args">()</span>
|
365
|
-
<span class="method-click-advice">click to toggle source</span>
|
366
|
-
</div>
|
367
|
-
|
368
|
-
|
369
|
-
<div class="method-description">
|
370
|
-
|
371
|
-
<p>removes all [] elements, and decrements accordingly the @<a
|
372
|
-
href="TimeLine.html#attribute-i-indices_of">indices_of</a></p>
|
373
|
-
|
374
|
-
<pre>ideally this should be transactional</pre>
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
<div class="method-source-code" id="compress-21-source">
|
379
|
-
<pre>
|
380
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 219</span>
|
381
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">compress!</span>
|
382
|
-
<span class="ruby-identifier">mod_level</span> = <span class="ruby-value">0</span>
|
383
|
-
<span class="ruby-identifier">offsets</span> = []
|
384
|
-
<span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">line</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
385
|
-
<span class="ruby-identifier">mod_level</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@line</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">empty?</span>
|
386
|
-
<span class="ruby-identifier">offsets</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">mod_level</span>
|
387
|
-
<span class="ruby-keyword">end</span>
|
388
|
-
<span class="ruby-comment">## poor man's transaction. Don't do directly on indices_of so less chance of interruption</span>
|
389
|
-
<span class="ruby-identifier">indices</span> = <span class="ruby-identifier">indices_of</span>
|
390
|
-
<span class="ruby-identifier">indices</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
391
|
-
<span class="ruby-identifier">indices</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">indices</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">offsets</span>[<span class="ruby-identifier">indices</span>[<span class="ruby-identifier">key</span>]]
|
392
|
-
<span class="ruby-keyword">end</span>
|
393
|
-
<span class="ruby-identifier">indices_of</span> = <span class="ruby-identifier">indices</span>
|
394
|
-
<span class="ruby-ivar">@line</span>.<span class="ruby-identifier">delete</span>([])
|
395
|
-
<span class="ruby-keyword">end</span></pre>
|
396
|
-
</div><!-- compress-21-source -->
|
397
|
-
|
398
|
-
</div>
|
312
|
+
<li class="public ">
|
313
|
+
<span class="summary_signature">
|
314
|
+
|
315
|
+
<a href="#append-instance_method" title="#append (instance method)">- (Fixnum) <strong>append</strong>(obj) </a>
|
316
|
+
|
399
317
|
|
400
|
-
|
318
|
+
|
319
|
+
</span>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
401
326
|
|
402
|
-
|
403
|
-
|
327
|
+
|
328
|
+
<span class="summary_desc"><div class='inline'>
|
329
|
+
<p>add to the end of the TimeLine.</p>
|
330
|
+
</div></span>
|
331
|
+
|
332
|
+
</li>
|
404
333
|
|
405
334
|
|
406
|
-
<
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
<span class="method-name">increase_after</span><span
|
412
|
-
class="method-args">(pos, by=1)</span>
|
413
|
-
<span class="method-click-advice">click to toggle source</span>
|
414
|
-
</div>
|
415
|
-
|
416
|
-
|
417
|
-
<div class="method-description">
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
<div class="method-source-code" id="increase_after-source">
|
424
|
-
<pre>
|
425
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 168</span>
|
426
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">increase_after</span>(<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">by</span>=<span class="ruby-value">1</span>)
|
427
|
-
<span class="ruby-ivar">@indices_of</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
428
|
-
<span class="ruby-ivar">@indices_of</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">by</span> <span class="ruby-keyword">if</span> (<span class="ruby-ivar">@indices_of</span>[<span class="ruby-identifier">key</span>] <span class="ruby-operator">>=</span> <span class="ruby-identifier">pos</span>)
|
429
|
-
<span class="ruby-keyword">end</span>
|
430
|
-
<span class="ruby-keyword">end</span></pre>
|
431
|
-
</div><!-- increase_after-source -->
|
432
|
-
|
433
|
-
</div>
|
335
|
+
<li class="public ">
|
336
|
+
<span class="summary_signature">
|
337
|
+
|
338
|
+
<a href="#append_to_next-instance_method" title="#append_to_next (instance method)">- (Fixnum) <strong>append_to_next</strong>(relative_obj, obj, relative = 1) </a>
|
339
|
+
|
434
340
|
|
435
|
-
|
341
|
+
|
342
|
+
</span>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
436
349
|
|
437
|
-
|
438
|
-
|
350
|
+
|
351
|
+
<span class="summary_desc"><div class='inline'>
|
352
|
+
<p>inserts to the end of the relative object's time, becoming equal with it.</p>
|
353
|
+
</div></span>
|
354
|
+
|
355
|
+
</li>
|
439
356
|
|
440
357
|
|
441
|
-
<
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
<span class="method-name">insert_at</span><span
|
447
|
-
class="method-args">(pos, obj)</span>
|
448
|
-
<span class="method-click-advice">click to toggle source</span>
|
449
|
-
</div>
|
450
|
-
|
451
|
-
|
452
|
-
<div class="method-description">
|
453
|
-
|
454
|
-
<p>place obj at the numbered position</p>
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
<div class="method-source-code" id="insert_at-source">
|
459
|
-
<pre>
|
460
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 195</span>
|
461
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">insert_at</span>(<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">obj</span>)
|
462
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-string">"can only add a time to its own timeline"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">timeline</span>.<span class="ruby-identifier">equal?</span> <span class="ruby-keyword">self</span>
|
463
|
-
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@line</span>[<span class="ruby-identifier">pos</span>].<span class="ruby-identifier">nil?</span>
|
464
|
-
<span class="ruby-ivar">@line</span>[<span class="ruby-identifier">pos</span>] = [<span class="ruby-identifier">obj</span>]
|
465
|
-
<span class="ruby-keyword">else</span>
|
466
|
-
<span class="ruby-identifier">op</span> = <span class="ruby-ivar">@line</span>[<span class="ruby-identifier">pos</span>].<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-operator">?</span> <span class="ruby-string">'<<'</span> <span class="ruby-operator">:</span> <span class="ruby-string">'='</span>
|
467
|
-
<span class="ruby-ivar">@line</span>[<span class="ruby-identifier">pos</span>].<span class="ruby-identifier">send</span>(<span class="ruby-identifier">op</span>.<span class="ruby-identifier">to_sym</span>, <span class="ruby-identifier">obj</span>).<span class="ruby-identifier">uniq!</span> <span class="ruby-comment"># no duplicates in same position</span>
|
468
|
-
<span class="ruby-comment"># dup in diff position overwrites below</span>
|
469
|
-
<span class="ruby-keyword">end</span>
|
470
|
-
<span class="ruby-ivar">@indices_of</span>[<span class="ruby-identifier">obj</span>] = <span class="ruby-identifier">pos</span>
|
471
|
-
<span class="ruby-keyword">end</span></pre>
|
472
|
-
</div><!-- insert_at-source -->
|
473
|
-
|
474
|
-
</div>
|
358
|
+
<li class="public ">
|
359
|
+
<span class="summary_signature">
|
360
|
+
|
361
|
+
<a href="#compress%21-instance_method" title="#compress! (instance method)">- (nil) <strong>compress!</strong> </a>
|
362
|
+
|
475
363
|
|
476
|
-
|
364
|
+
|
365
|
+
</span>
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
|
371
|
+
|
477
372
|
|
478
|
-
|
479
|
-
|
373
|
+
|
374
|
+
<span class="summary_desc"><div class='inline'>
|
375
|
+
<p>removes all [] elements, and decrements accordingly the @indices_of.</p>
|
376
|
+
</div></span>
|
377
|
+
|
378
|
+
</li>
|
480
379
|
|
481
380
|
|
482
|
-
<
|
483
|
-
|
381
|
+
<li class="public ">
|
382
|
+
<span class="summary_signature">
|
383
|
+
|
384
|
+
<a href="#increase_after-instance_method" title="#increase_after (instance method)">- (Object) <strong>increase_after</strong>(pos, by = 1) </a>
|
385
|
+
|
484
386
|
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
387
|
+
|
388
|
+
</span>
|
389
|
+
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
492
395
|
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
<div class="method-source-code" id="insert_before_next-source">
|
500
|
-
<pre>
|
501
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 187</span>
|
502
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">insert_before_next</span>(<span class="ruby-identifier">relative_obj</span>, <span class="ruby-identifier">obj</span>, <span class="ruby-identifier">relative_offset</span>=<span class="ruby-value">1</span>)
|
503
|
-
<span class="ruby-identifier">relative_position</span> = <span class="ruby-identifier">position_of</span>(<span class="ruby-identifier">relative_obj</span>)
|
504
|
-
<span class="ruby-identifier">increase_after</span>(<span class="ruby-identifier">relative_position</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">relative_offset</span>, <span class="ruby-identifier">relative_offset</span>)
|
505
|
-
<span class="ruby-ivar">@line</span>[<span class="ruby-identifier">relative_position</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">relative_offset</span>,<span class="ruby-value">0</span>] = <span class="ruby-keyword">nil</span>
|
506
|
-
<span class="ruby-identifier">insert_at</span>(<span class="ruby-identifier">relative_position</span><span class="ruby-operator">+</span><span class="ruby-identifier">relative_offset</span>, <span class="ruby-identifier">obj</span>)
|
507
|
-
<span class="ruby-keyword">end</span></pre>
|
508
|
-
</div><!-- insert_before_next-source -->
|
509
|
-
|
510
|
-
</div>
|
396
|
+
|
397
|
+
<span class="summary_desc"><div class='inline'>
|
398
|
+
<p>bump up indices after a point, so that a RelativeTime may be inserted.</p>
|
399
|
+
</div></span>
|
400
|
+
|
401
|
+
</li>
|
511
402
|
|
512
|
-
|
403
|
+
|
404
|
+
<li class="public ">
|
405
|
+
<span class="summary_signature">
|
406
|
+
|
407
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (TimeLine) <strong>initialize</strong>(name = "") </a>
|
408
|
+
|
513
409
|
|
514
|
-
|
515
|
-
|
410
|
+
|
411
|
+
</span>
|
412
|
+
|
413
|
+
<span class="note title constructor">constructor</span>
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
<span class="summary_desc"><div class='inline'>
|
423
|
+
<p>A new instance of TimeLine.</p>
|
424
|
+
</div></span>
|
425
|
+
|
426
|
+
</li>
|
516
427
|
|
517
428
|
|
518
|
-
<
|
519
|
-
|
429
|
+
<li class="public ">
|
430
|
+
<span class="summary_signature">
|
431
|
+
|
432
|
+
<a href="#insert_at-instance_method" title="#insert_at (instance method)">- (Fixnum) <strong>insert_at</strong>(pos, obj) </a>
|
433
|
+
|
520
434
|
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
435
|
+
|
436
|
+
</span>
|
437
|
+
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
|
528
443
|
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
<div class="method-source-code" id="position_of-source">
|
536
|
-
<pre>
|
537
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 164</span>
|
538
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">position_of</span>(<span class="ruby-identifier">obj</span>)
|
539
|
-
<span class="ruby-ivar">@indices_of</span>[<span class="ruby-identifier">obj</span>]
|
540
|
-
<span class="ruby-keyword">end</span></pre>
|
541
|
-
</div><!-- position_of-source -->
|
542
|
-
|
543
|
-
</div>
|
444
|
+
|
445
|
+
<span class="summary_desc"><div class='inline'>
|
446
|
+
<p>place obj at the numbered position.</p>
|
447
|
+
</div></span>
|
448
|
+
|
449
|
+
</li>
|
544
450
|
|
545
|
-
|
451
|
+
|
452
|
+
<li class="public ">
|
453
|
+
<span class="summary_signature">
|
454
|
+
|
455
|
+
<a href="#insert_before_next-instance_method" title="#insert_before_next (instance method)">- (Fixnum) <strong>insert_before_next</strong>(relative_obj, obj, relative_offset = 1) </a>
|
456
|
+
|
546
457
|
|
547
|
-
|
548
|
-
|
458
|
+
|
459
|
+
</span>
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
|
468
|
+
<span class="summary_desc"><div class='inline'>
|
469
|
+
<p>inserts into a new space before the relative object (first parameter)
|
470
|
+
inserts obj before relative_obj by offset.</p>
|
471
|
+
</div></span>
|
472
|
+
|
473
|
+
</li>
|
549
474
|
|
550
475
|
|
551
|
-
<
|
552
|
-
|
476
|
+
<li class="public ">
|
477
|
+
<span class="summary_signature">
|
478
|
+
|
479
|
+
<a href="#inspect-instance_method" title="#inspect (instance method)">- (String) <strong>inspect</strong> </a>
|
480
|
+
|
553
481
|
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
482
|
+
|
483
|
+
</span>
|
484
|
+
|
485
|
+
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
561
490
|
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
<div class="method-source-code" id="remove-source">
|
571
|
-
<pre>
|
572
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 209</span>
|
573
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">obj</span>)
|
574
|
-
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">position_of</span>(<span class="ruby-identifier">obj</span>)
|
575
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">pos</span> <span class="ruby-comment"># do nothing if it isn't there'</span>
|
576
|
-
<span class="ruby-ivar">@line</span>[<span class="ruby-identifier">pos</span>].<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">obj</span>) <span class="ruby-comment"># remove from list</span>
|
577
|
-
<span class="ruby-ivar">@indices_of</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">obj</span>) <span class="ruby-comment"># remove from index</span>
|
578
|
-
<span class="ruby-keyword">end</span>
|
579
|
-
<span class="ruby-keyword">end</span></pre>
|
580
|
-
</div><!-- remove-source -->
|
581
|
-
|
582
|
-
</div>
|
491
|
+
|
492
|
+
<span class="summary_desc"><div class='inline'>
|
493
|
+
<p>endpoint statuses for all TimeSpans on the TimeLine, plus TimeLine name.</p>
|
494
|
+
</div></span>
|
495
|
+
|
496
|
+
</li>
|
583
497
|
|
584
|
-
|
498
|
+
|
499
|
+
<li class="public ">
|
500
|
+
<span class="summary_signature">
|
501
|
+
|
502
|
+
<a href="#position_of-instance_method" title="#position_of (instance method)">- (Fixnum) <strong>position_of</strong>(obj) </a>
|
503
|
+
|
585
504
|
|
586
|
-
|
587
|
-
|
505
|
+
|
506
|
+
</span>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
|
512
|
+
|
513
|
+
|
514
|
+
|
515
|
+
<span class="summary_desc"><div class='inline'>
|
516
|
+
<p>find the position of a RelativeTime on the TimeLine.</p>
|
517
|
+
</div></span>
|
518
|
+
|
519
|
+
</li>
|
588
520
|
|
589
521
|
|
590
|
-
<
|
591
|
-
|
522
|
+
<li class="public ">
|
523
|
+
<span class="summary_signature">
|
524
|
+
|
525
|
+
<a href="#relative_times-instance_method" title="#relative_times (instance method)">- (Array) <strong>relative_times</strong> </a>
|
526
|
+
|
592
527
|
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
528
|
+
|
529
|
+
</span>
|
530
|
+
|
531
|
+
|
532
|
+
|
533
|
+
|
534
|
+
|
535
|
+
|
600
536
|
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
<div class="method-source-code" id="to_s-source">
|
608
|
-
<pre>
|
609
|
-
<span class="ruby-comment"># File lib/time_span.rb, line 152</span>
|
610
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
611
|
-
<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
|
612
|
-
<span class="ruby-keyword">end</span></pre>
|
613
|
-
</div><!-- to_s-source -->
|
614
|
-
|
615
|
-
</div>
|
537
|
+
|
538
|
+
<span class="summary_desc"><div class='inline'>
|
539
|
+
<p>attached times only (internal API).</p>
|
540
|
+
</div></span>
|
541
|
+
|
542
|
+
</li>
|
616
543
|
|
617
|
-
|
544
|
+
|
545
|
+
<li class="public ">
|
546
|
+
<span class="summary_signature">
|
547
|
+
|
548
|
+
<a href="#remove-instance_method" title="#remove (instance method)">- (Object) <strong>remove</strong>(obj) </a>
|
549
|
+
|
618
550
|
|
619
|
-
|
620
|
-
|
551
|
+
|
552
|
+
</span>
|
553
|
+
|
554
|
+
|
555
|
+
|
556
|
+
|
557
|
+
|
558
|
+
|
559
|
+
|
560
|
+
|
561
|
+
<span class="summary_desc"><div class='inline'>
|
562
|
+
<p>cannot remove [] or the @indices_of will be wrong call #compress to remove
|
563
|
+
the extra []s.</p>
|
564
|
+
</div></span>
|
565
|
+
|
566
|
+
</li>
|
567
|
+
|
568
|
+
|
569
|
+
<li class="public ">
|
570
|
+
<span class="summary_signature">
|
571
|
+
|
572
|
+
<a href="#to_s-instance_method" title="#to_s (instance method)">- (String) <strong>to_s</strong> </a>
|
573
|
+
|
574
|
+
|
575
|
+
|
576
|
+
</span>
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
<span class="summary_desc"><div class='inline'>
|
586
|
+
<p>returns the TimeLine's name.</p>
|
587
|
+
</div></span>
|
588
|
+
|
589
|
+
</li>
|
590
|
+
|
591
|
+
|
592
|
+
</ul>
|
593
|
+
|
594
|
+
|
595
|
+
|
596
|
+
<div id="constructor_details" class="method_details_list">
|
597
|
+
<h2>Constructor Details</h2>
|
598
|
+
|
599
|
+
<div class="method_details first">
|
600
|
+
<p class="signature first" id="initialize-instance_method">
|
601
|
+
|
602
|
+
- (<tt><span class='object_link'><a href="" title="TimeSpan::TimeLine (class)">TimeLine</a></span></tt>) <strong>initialize</strong>(name = "")
|
603
|
+
|
604
|
+
|
605
|
+
|
606
|
+
</p><div class="docstring">
|
607
|
+
<div class="discussion">
|
608
|
+
|
609
|
+
<p>A new instance of TimeLine</p>
|
610
|
+
|
611
|
+
|
612
|
+
</div>
|
613
|
+
</div>
|
614
|
+
<div class="tags">
|
615
|
+
|
616
|
+
|
617
|
+
</div><table class="source_code">
|
618
|
+
<tr>
|
619
|
+
<td>
|
620
|
+
<pre class="lines">
|
621
|
+
|
622
|
+
|
623
|
+
241
|
624
|
+
242
|
625
|
+
243
|
626
|
+
244
|
627
|
+
245
|
628
|
+
246</pre>
|
629
|
+
</td>
|
630
|
+
<td>
|
631
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 241</span>
|
632
|
+
|
633
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='op'>=</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
634
|
+
<span class='ivar'>@name</span> <span class='op'>=</span> <span class='id identifier rubyid_name'>name</span>
|
635
|
+
<span class='ivar'>@line</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
636
|
+
<span class='ivar'>@indices_of</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
637
|
+
<span class='ivar'>@spans</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
638
|
+
<span class='kw'>end</span></pre>
|
639
|
+
</td>
|
640
|
+
</tr>
|
641
|
+
</table>
|
642
|
+
</div>
|
643
|
+
|
644
|
+
</div>
|
645
|
+
|
646
|
+
<div id="instance_attr_details" class="attr_details">
|
647
|
+
<h2>Instance Attribute Details</h2>
|
648
|
+
|
649
|
+
|
650
|
+
<span id="indices_of=-instance_method"></span>
|
651
|
+
<span id="indices_of-instance_method"></span>
|
652
|
+
<div class="method_details first">
|
653
|
+
<p class="signature first" id="indices_of-instance_method">
|
654
|
+
|
655
|
+
- (<tt>Object</tt>) <strong>indices_of</strong>
|
656
|
+
|
657
|
+
|
658
|
+
|
659
|
+
</p><div class="docstring">
|
660
|
+
<div class="discussion">
|
661
|
+
|
662
|
+
<p>Returns the value of attribute indices_of</p>
|
663
|
+
|
664
|
+
|
665
|
+
</div>
|
666
|
+
</div>
|
667
|
+
<div class="tags">
|
668
|
+
|
669
|
+
|
670
|
+
</div><table class="source_code">
|
671
|
+
<tr>
|
672
|
+
<td>
|
673
|
+
<pre class="lines">
|
674
|
+
|
675
|
+
|
676
|
+
238
|
677
|
+
239
|
678
|
+
240</pre>
|
679
|
+
</td>
|
680
|
+
<td>
|
681
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 238</span>
|
682
|
+
|
683
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_indices_of'>indices_of</span>
|
684
|
+
<span class='ivar'>@indices_of</span>
|
685
|
+
<span class='kw'>end</span></pre>
|
686
|
+
</td>
|
687
|
+
</tr>
|
688
|
+
</table>
|
689
|
+
</div>
|
690
|
+
|
691
|
+
|
692
|
+
<span id="line=-instance_method"></span>
|
693
|
+
<span id="line-instance_method"></span>
|
694
|
+
<div class="method_details ">
|
695
|
+
<p class="signature " id="line-instance_method">
|
696
|
+
|
697
|
+
- (<tt>Object</tt>) <strong>line</strong>
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
</p><div class="docstring">
|
702
|
+
<div class="discussion">
|
703
|
+
|
704
|
+
<p>Returns the value of attribute line</p>
|
705
|
+
|
706
|
+
|
707
|
+
</div>
|
708
|
+
</div>
|
709
|
+
<div class="tags">
|
710
|
+
|
711
|
+
|
712
|
+
</div><table class="source_code">
|
713
|
+
<tr>
|
714
|
+
<td>
|
715
|
+
<pre class="lines">
|
716
|
+
|
717
|
+
|
718
|
+
238
|
719
|
+
239
|
720
|
+
240</pre>
|
721
|
+
</td>
|
722
|
+
<td>
|
723
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 238</span>
|
724
|
+
|
725
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_line'>line</span>
|
726
|
+
<span class='ivar'>@line</span>
|
727
|
+
<span class='kw'>end</span></pre>
|
728
|
+
</td>
|
729
|
+
</tr>
|
730
|
+
</table>
|
731
|
+
</div>
|
732
|
+
|
733
|
+
|
734
|
+
<span id="name=-instance_method"></span>
|
735
|
+
<span id="name-instance_method"></span>
|
736
|
+
<div class="method_details ">
|
737
|
+
<p class="signature " id="name-instance_method">
|
738
|
+
|
739
|
+
- (<tt>Object</tt>) <strong>name</strong>
|
740
|
+
|
741
|
+
|
742
|
+
|
743
|
+
</p><div class="docstring">
|
744
|
+
<div class="discussion">
|
745
|
+
|
746
|
+
<p>Returns the value of attribute name</p>
|
747
|
+
|
748
|
+
|
749
|
+
</div>
|
750
|
+
</div>
|
751
|
+
<div class="tags">
|
752
|
+
|
753
|
+
|
754
|
+
</div><table class="source_code">
|
755
|
+
<tr>
|
756
|
+
<td>
|
757
|
+
<pre class="lines">
|
758
|
+
|
759
|
+
|
760
|
+
238
|
761
|
+
239
|
762
|
+
240</pre>
|
763
|
+
</td>
|
764
|
+
<td>
|
765
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 238</span>
|
766
|
+
|
767
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_name'>name</span>
|
768
|
+
<span class='ivar'>@name</span>
|
769
|
+
<span class='kw'>end</span></pre>
|
770
|
+
</td>
|
771
|
+
</tr>
|
772
|
+
</table>
|
773
|
+
</div>
|
774
|
+
|
775
|
+
|
776
|
+
<span id="spans=-instance_method"></span>
|
777
|
+
<span id="spans-instance_method"></span>
|
778
|
+
<div class="method_details ">
|
779
|
+
<p class="signature " id="spans-instance_method">
|
780
|
+
|
781
|
+
- (<tt>Object</tt>) <strong>spans</strong>
|
782
|
+
|
783
|
+
|
784
|
+
|
785
|
+
</p><div class="docstring">
|
786
|
+
<div class="discussion">
|
787
|
+
|
788
|
+
<p>Returns the value of attribute spans</p>
|
789
|
+
|
790
|
+
|
791
|
+
</div>
|
792
|
+
</div>
|
793
|
+
<div class="tags">
|
794
|
+
|
795
|
+
|
796
|
+
</div><table class="source_code">
|
797
|
+
<tr>
|
798
|
+
<td>
|
799
|
+
<pre class="lines">
|
800
|
+
|
801
|
+
|
802
|
+
238
|
803
|
+
239
|
804
|
+
240</pre>
|
805
|
+
</td>
|
806
|
+
<td>
|
807
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 238</span>
|
808
|
+
|
809
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_spans'>spans</span>
|
810
|
+
<span class='ivar'>@spans</span>
|
811
|
+
<span class='kw'>end</span></pre>
|
812
|
+
</td>
|
813
|
+
</tr>
|
814
|
+
</table>
|
815
|
+
</div>
|
816
|
+
|
817
|
+
</div>
|
818
|
+
|
819
|
+
|
820
|
+
<div id="instance_method_details" class="method_details_list">
|
821
|
+
<h2>Instance Method Details</h2>
|
822
|
+
|
823
|
+
|
824
|
+
<div class="method_details first">
|
825
|
+
<p class="signature first" id="all_endpoint_statuses-instance_method">
|
826
|
+
|
827
|
+
- (<tt>Array</tt>) <strong>all_endpoint_statuses</strong>
|
828
|
+
|
829
|
+
|
830
|
+
|
831
|
+
</p><div class="docstring">
|
832
|
+
<div class="discussion">
|
833
|
+
|
834
|
+
<p>Endpoint statuses for all TimeSpan s on the TimeLine</p>
|
835
|
+
|
836
|
+
|
837
|
+
</div>
|
838
|
+
</div>
|
839
|
+
<div class="tags">
|
840
|
+
|
841
|
+
<h3>Returns:</h3>
|
842
|
+
<ul class="return">
|
843
|
+
|
844
|
+
<li>
|
845
|
+
|
846
|
+
|
847
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
848
|
+
|
849
|
+
|
850
|
+
|
851
|
+
—
|
852
|
+
<div class='inline'>
|
853
|
+
<p>endpoint statuses for all TimeSpan s on the TimeLine</p>
|
854
|
+
</div>
|
855
|
+
|
856
|
+
</li>
|
857
|
+
|
858
|
+
</ul>
|
859
|
+
|
860
|
+
</div><table class="source_code">
|
861
|
+
<tr>
|
862
|
+
<td>
|
863
|
+
<pre class="lines">
|
864
|
+
|
865
|
+
|
866
|
+
261
|
867
|
+
262
|
868
|
+
263</pre>
|
869
|
+
</td>
|
870
|
+
<td>
|
871
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 261</span>
|
872
|
+
|
873
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_all_endpoint_statuses'>all_endpoint_statuses</span>
|
874
|
+
<span class='id identifier rubyid_spans'>spans</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_acc'>acc</span><span class='comma'>,</span> <span class='id identifier rubyid_span'>span</span><span class='op'>|</span> <span class='id identifier rubyid_acc'>acc</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_span'>span</span><span class='period'>.</span><span class='id identifier rubyid_endpoint_statuses'>endpoint_statuses</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
875
|
+
<span class='kw'>end</span></pre>
|
876
|
+
</td>
|
877
|
+
</tr>
|
878
|
+
</table>
|
879
|
+
</div>
|
880
|
+
|
881
|
+
<div class="method_details ">
|
882
|
+
<p class="signature " id="all_relative_time_statuses-instance_method">
|
883
|
+
|
884
|
+
- (<tt>Array</tt>) <strong>all_relative_time_statuses</strong>
|
885
|
+
|
886
|
+
|
887
|
+
|
888
|
+
</p><div class="docstring">
|
889
|
+
<div class="discussion">
|
890
|
+
|
891
|
+
<p>all statuses on the TimeLine</p>
|
892
|
+
|
893
|
+
|
894
|
+
</div>
|
895
|
+
</div>
|
896
|
+
<div class="tags">
|
897
|
+
|
898
|
+
<h3>Returns:</h3>
|
899
|
+
<ul class="return">
|
900
|
+
|
901
|
+
<li>
|
902
|
+
|
903
|
+
|
904
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
905
|
+
|
906
|
+
|
907
|
+
|
908
|
+
—
|
909
|
+
<div class='inline'>
|
910
|
+
<p>statuses for all attached RelativeTime s on the TimeLine</p>
|
911
|
+
</div>
|
912
|
+
|
913
|
+
</li>
|
914
|
+
|
915
|
+
</ul>
|
916
|
+
|
917
|
+
</div><table class="source_code">
|
918
|
+
<tr>
|
919
|
+
<td>
|
920
|
+
<pre class="lines">
|
921
|
+
|
922
|
+
|
923
|
+
273
|
924
|
+
274
|
925
|
+
275</pre>
|
926
|
+
</td>
|
927
|
+
<td>
|
928
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 273</span>
|
929
|
+
|
930
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_all_relative_time_statuses'>all_relative_time_statuses</span>
|
931
|
+
<span class='id identifier rubyid_relative_times'>relative_times</span><span class='period'>.</span><span class='id identifier rubyid_inject'>inject</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_acc'>acc</span><span class='comma'>,</span> <span class='id identifier rubyid_v'>v</span><span class='op'>|</span> <span class='id identifier rubyid_acc'>acc</span> <span class='op'><<</span> <span class='id identifier rubyid_v'>v</span><span class='period'>.</span><span class='id identifier rubyid_reference_to'>reference_to</span> <span class='rbrace'>}</span>
|
932
|
+
<span class='kw'>end</span></pre>
|
933
|
+
</td>
|
934
|
+
</tr>
|
935
|
+
</table>
|
936
|
+
</div>
|
937
|
+
|
938
|
+
<div class="method_details ">
|
939
|
+
<p class="signature " id="append-instance_method">
|
940
|
+
|
941
|
+
- (<tt>Fixnum</tt>) <strong>append</strong>(obj)
|
942
|
+
|
943
|
+
|
944
|
+
|
945
|
+
</p><div class="docstring">
|
946
|
+
<div class="discussion">
|
947
|
+
|
948
|
+
<p>add to the end of the TimeLine</p>
|
949
|
+
|
950
|
+
|
951
|
+
</div>
|
952
|
+
</div>
|
953
|
+
<div class="tags">
|
954
|
+
<h3>Parameters:</h3>
|
955
|
+
<ul class="param">
|
956
|
+
|
957
|
+
<li>
|
958
|
+
|
959
|
+
<span class='name'>obj</span>
|
960
|
+
|
961
|
+
|
962
|
+
<span class='type'></span>
|
963
|
+
|
964
|
+
|
965
|
+
|
966
|
+
—
|
967
|
+
<div class='inline'>
|
968
|
+
<p>object to be inserted into the TimeLine</p>
|
969
|
+
</div>
|
970
|
+
|
971
|
+
</li>
|
972
|
+
|
973
|
+
</ul>
|
974
|
+
|
975
|
+
<h3>Returns:</h3>
|
976
|
+
<ul class="return">
|
977
|
+
|
978
|
+
<li>
|
979
|
+
|
980
|
+
|
981
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
982
|
+
|
983
|
+
|
984
|
+
|
985
|
+
—
|
986
|
+
<div class='inline'>
|
987
|
+
<p>]the (relative) position where the object was inserted</p>
|
988
|
+
</div>
|
989
|
+
|
990
|
+
</li>
|
991
|
+
|
992
|
+
</ul>
|
993
|
+
|
994
|
+
</div><table class="source_code">
|
995
|
+
<tr>
|
996
|
+
<td>
|
997
|
+
<pre class="lines">
|
998
|
+
|
999
|
+
|
1000
|
+
298
|
1001
|
+
299
|
1002
|
+
300</pre>
|
1003
|
+
</td>
|
1004
|
+
<td>
|
1005
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 298</span>
|
1006
|
+
|
1007
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_append'>append</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
|
1008
|
+
<span class='id identifier rubyid_insert_at'>insert_at</span><span class='lparen'>(</span><span class='ivar'>@line</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
|
1009
|
+
<span class='kw'>end</span></pre>
|
1010
|
+
</td>
|
1011
|
+
</tr>
|
1012
|
+
</table>
|
1013
|
+
</div>
|
1014
|
+
|
1015
|
+
<div class="method_details ">
|
1016
|
+
<p class="signature " id="append_to_next-instance_method">
|
1017
|
+
|
1018
|
+
- (<tt>Fixnum</tt>) <strong>append_to_next</strong>(relative_obj, obj, relative = 1)
|
1019
|
+
|
1020
|
+
|
1021
|
+
|
1022
|
+
</p><div class="docstring">
|
1023
|
+
<div class="discussion">
|
1024
|
+
|
1025
|
+
<p>inserts to the end of the relative object's time, becoming equal with it</p>
|
1026
|
+
|
1027
|
+
|
1028
|
+
</div>
|
1029
|
+
</div>
|
1030
|
+
<div class="tags">
|
1031
|
+
<h3>Parameters:</h3>
|
1032
|
+
<ul class="param">
|
1033
|
+
|
1034
|
+
<li>
|
1035
|
+
|
1036
|
+
<span class='name'>relative_obj</span>
|
1037
|
+
|
1038
|
+
|
1039
|
+
<span class='type'></span>
|
1040
|
+
|
1041
|
+
|
1042
|
+
|
1043
|
+
—
|
1044
|
+
<div class='inline'>
|
1045
|
+
<p>object after which to insert obj</p>
|
1046
|
+
</div>
|
1047
|
+
|
1048
|
+
</li>
|
1049
|
+
|
1050
|
+
<li>
|
1051
|
+
|
1052
|
+
<span class='name'>obj</span>
|
1053
|
+
|
1054
|
+
|
1055
|
+
<span class='type'></span>
|
1056
|
+
|
1057
|
+
|
1058
|
+
|
1059
|
+
—
|
1060
|
+
<div class='inline'>
|
1061
|
+
<p>object inserted after relative_object</p>
|
1062
|
+
</div>
|
1063
|
+
|
1064
|
+
</li>
|
1065
|
+
|
1066
|
+
</ul>
|
1067
|
+
|
1068
|
+
<h3>Returns:</h3>
|
1069
|
+
<ul class="return">
|
1070
|
+
|
1071
|
+
<li>
|
1072
|
+
|
1073
|
+
|
1074
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1075
|
+
|
1076
|
+
|
1077
|
+
|
1078
|
+
—
|
1079
|
+
<div class='inline'>
|
1080
|
+
<p>]the (relative) position where the object was inserted</p>
|
1081
|
+
</div>
|
1082
|
+
|
1083
|
+
</li>
|
1084
|
+
|
1085
|
+
</ul>
|
1086
|
+
|
1087
|
+
</div><table class="source_code">
|
1088
|
+
<tr>
|
1089
|
+
<td>
|
1090
|
+
<pre class="lines">
|
1091
|
+
|
1092
|
+
|
1093
|
+
306
|
1094
|
+
307
|
1095
|
+
308</pre>
|
1096
|
+
</td>
|
1097
|
+
<td>
|
1098
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 306</span>
|
1099
|
+
|
1100
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_append_to_next'>append_to_next</span><span class='lparen'>(</span><span class='id identifier rubyid_relative_obj'>relative_obj</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='comma'>,</span> <span class='id identifier rubyid_relative'>relative</span><span class='op'>=</span><span class='int'>1</span><span class='rparen'>)</span>
|
1101
|
+
<span class='id identifier rubyid_insert_at'>insert_at</span><span class='lparen'>(</span><span class='id identifier rubyid_position_of'>position_of</span><span class='lparen'>(</span><span class='id identifier rubyid_relative_obj'>relative_obj</span><span class='rparen'>)</span><span class='op'>+</span><span class='id identifier rubyid_relative'>relative</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
|
1102
|
+
<span class='kw'>end</span></pre>
|
1103
|
+
</td>
|
1104
|
+
</tr>
|
1105
|
+
</table>
|
1106
|
+
</div>
|
1107
|
+
|
1108
|
+
<div class="method_details ">
|
1109
|
+
<p class="signature " id="compress!-instance_method">
|
1110
|
+
|
1111
|
+
- (<tt>nil</tt>) <strong>compress!</strong>
|
1112
|
+
|
1113
|
+
|
1114
|
+
|
1115
|
+
</p><div class="docstring">
|
1116
|
+
<div class="discussion">
|
1117
|
+
|
1118
|
+
<p>removes all [] elements, and decrements accordingly the @indices_of</p>
|
1119
|
+
|
1120
|
+
<pre class="code ruby"><code><span class='id identifier rubyid_ideally'>ideally</span> <span class='id identifier rubyid_this'>this</span> <span class='id identifier rubyid_should'>should</span> <span class='id identifier rubyid_be'>be</span> <span class='id identifier rubyid_transactional'>transactional</span></code></pre>
|
1121
|
+
|
1122
|
+
|
1123
|
+
</div>
|
1124
|
+
</div>
|
1125
|
+
<div class="tags">
|
1126
|
+
|
1127
|
+
<h3>Returns:</h3>
|
1128
|
+
<ul class="return">
|
1129
|
+
|
1130
|
+
<li>
|
1131
|
+
|
1132
|
+
|
1133
|
+
<span class='type'>(<tt>nil</tt>)</span>
|
1134
|
+
|
1135
|
+
|
1136
|
+
|
1137
|
+
—
|
1138
|
+
<div class='inline'>
|
1139
|
+
<p>cleanup method</p>
|
1140
|
+
</div>
|
1141
|
+
|
1142
|
+
</li>
|
1143
|
+
|
1144
|
+
</ul>
|
1145
|
+
|
1146
|
+
</div><table class="source_code">
|
1147
|
+
<tr>
|
1148
|
+
<td>
|
1149
|
+
<pre class="lines">
|
1150
|
+
|
1151
|
+
|
1152
|
+
353
|
1153
|
+
354
|
1154
|
+
355
|
1155
|
+
356
|
1156
|
+
357
|
1157
|
+
358
|
1158
|
+
359
|
1159
|
+
360
|
1160
|
+
361
|
1161
|
+
362
|
1162
|
+
363
|
1163
|
+
364
|
1164
|
+
365
|
1165
|
+
366
|
1166
|
+
367</pre>
|
1167
|
+
</td>
|
1168
|
+
<td>
|
1169
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 353</span>
|
1170
|
+
|
1171
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_compress!'>compress!</span>
|
1172
|
+
<span class='id identifier rubyid_mod_level'>mod_level</span> <span class='op'>=</span> <span class='int'>0</span>
|
1173
|
+
<span class='id identifier rubyid_offsets'>offsets</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
1174
|
+
<span class='int'>0</span><span class='period'>.</span><span class='id identifier rubyid_upto'>upto</span><span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='op'>-</span><span class='int'>1</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
1175
|
+
<span class='id identifier rubyid_mod_level'>mod_level</span> <span class='op'>-=</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='ivar'>@line</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
1176
|
+
<span class='id identifier rubyid_offsets'>offsets</span> <span class='op'><<</span> <span class='id identifier rubyid_mod_level'>mod_level</span>
|
1177
|
+
<span class='kw'>end</span>
|
1178
|
+
<span class='comment'>## poor man's transaction. Don't do directly on indices_of so less chance of interruption
|
1179
|
+
</span> <span class='id identifier rubyid_indices'>indices</span> <span class='op'>=</span> <span class='id identifier rubyid_indices_of'>indices_of</span>
|
1180
|
+
<span class='id identifier rubyid_indices'>indices</span><span class='period'>.</span><span class='id identifier rubyid_each_key'>each_key</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span>
|
1181
|
+
<span class='id identifier rubyid_indices'>indices</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_indices'>indices</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>+</span> <span class='id identifier rubyid_offsets'>offsets</span><span class='lbracket'>[</span><span class='id identifier rubyid_indices'>indices</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
1182
|
+
<span class='kw'>end</span>
|
1183
|
+
<span class='id identifier rubyid_indices_of'>indices_of</span> <span class='op'>=</span> <span class='id identifier rubyid_indices'>indices</span>
|
1184
|
+
<span class='ivar'>@line</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
1185
|
+
<span class='kw'>end</span></pre>
|
1186
|
+
</td>
|
1187
|
+
</tr>
|
1188
|
+
</table>
|
1189
|
+
</div>
|
1190
|
+
|
1191
|
+
<div class="method_details ">
|
1192
|
+
<p class="signature " id="increase_after-instance_method">
|
1193
|
+
|
1194
|
+
- (<tt>Object</tt>) <strong>increase_after</strong>(pos, by = 1)
|
1195
|
+
|
1196
|
+
|
1197
|
+
|
1198
|
+
</p><div class="docstring">
|
1199
|
+
<div class="discussion">
|
1200
|
+
|
1201
|
+
<p>bump up indices after a point, so that a RelativeTime may be inserted</p>
|
1202
|
+
|
1203
|
+
|
1204
|
+
</div>
|
1205
|
+
</div>
|
1206
|
+
<div class="tags">
|
1207
|
+
|
1208
|
+
<h3>Returns:</h3>
|
1209
|
+
<ul class="return">
|
1210
|
+
|
1211
|
+
<li>
|
1212
|
+
|
1213
|
+
|
1214
|
+
<span class='type'></span>
|
1215
|
+
|
1216
|
+
|
1217
|
+
|
1218
|
+
|
1219
|
+
<div class='inline'>
|
1220
|
+
<p>nil no return value, helper method to keep data structures up to date.</p>
|
1221
|
+
</div>
|
1222
|
+
|
1223
|
+
</li>
|
1224
|
+
|
1225
|
+
</ul>
|
1226
|
+
|
1227
|
+
</div><table class="source_code">
|
1228
|
+
<tr>
|
1229
|
+
<td>
|
1230
|
+
<pre class="lines">
|
1231
|
+
|
1232
|
+
|
1233
|
+
287
|
1234
|
+
288
|
1235
|
+
289
|
1236
|
+
290
|
1237
|
+
291</pre>
|
1238
|
+
</td>
|
1239
|
+
<td>
|
1240
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 287</span>
|
1241
|
+
|
1242
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_increase_after'>increase_after</span><span class='lparen'>(</span><span class='id identifier rubyid_pos'>pos</span><span class='comma'>,</span> <span class='id identifier rubyid_by'>by</span><span class='op'>=</span><span class='int'>1</span><span class='rparen'>)</span>
|
1243
|
+
<span class='ivar'>@indices_of</span><span class='period'>.</span><span class='id identifier rubyid_each_key'>each_key</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='op'>|</span>
|
1244
|
+
<span class='ivar'>@indices_of</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>+=</span> <span class='id identifier rubyid_by'>by</span> <span class='kw'>if</span> <span class='lparen'>(</span><span class='ivar'>@indices_of</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>>=</span> <span class='id identifier rubyid_pos'>pos</span><span class='rparen'>)</span>
|
1245
|
+
<span class='kw'>end</span>
|
1246
|
+
<span class='kw'>end</span></pre>
|
1247
|
+
</td>
|
1248
|
+
</tr>
|
1249
|
+
</table>
|
1250
|
+
</div>
|
1251
|
+
|
1252
|
+
<div class="method_details ">
|
1253
|
+
<p class="signature " id="insert_at-instance_method">
|
1254
|
+
|
1255
|
+
- (<tt>Fixnum</tt>) <strong>insert_at</strong>(pos, obj)
|
1256
|
+
|
1257
|
+
|
1258
|
+
|
1259
|
+
</p><div class="docstring">
|
1260
|
+
<div class="discussion">
|
1261
|
+
|
1262
|
+
<p>place obj at the numbered position</p>
|
1263
|
+
|
1264
|
+
|
1265
|
+
</div>
|
1266
|
+
</div>
|
1267
|
+
<div class="tags">
|
1268
|
+
<h3>Parameters:</h3>
|
1269
|
+
<ul class="param">
|
1270
|
+
|
1271
|
+
<li>
|
1272
|
+
|
1273
|
+
<span class='name'>pos</span>
|
1274
|
+
|
1275
|
+
|
1276
|
+
<span class='type'></span>
|
1277
|
+
|
1278
|
+
|
1279
|
+
|
1280
|
+
—
|
1281
|
+
<div class='inline'>
|
1282
|
+
<p>where to insert obj in the TimeLIne</p>
|
1283
|
+
</div>
|
1284
|
+
|
1285
|
+
</li>
|
1286
|
+
|
1287
|
+
<li>
|
1288
|
+
|
1289
|
+
<span class='name'>obj</span>
|
1290
|
+
|
1291
|
+
|
1292
|
+
<span class='type'></span>
|
1293
|
+
|
1294
|
+
|
1295
|
+
|
1296
|
+
—
|
1297
|
+
<div class='inline'>
|
1298
|
+
<p>obj inserted into the TimeLIne</p>
|
1299
|
+
</div>
|
1300
|
+
|
1301
|
+
</li>
|
1302
|
+
|
1303
|
+
</ul>
|
1304
|
+
|
1305
|
+
<h3>Returns:</h3>
|
1306
|
+
<ul class="return">
|
1307
|
+
|
1308
|
+
<li>
|
1309
|
+
|
1310
|
+
|
1311
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1312
|
+
|
1313
|
+
|
1314
|
+
|
1315
|
+
—
|
1316
|
+
<div class='inline'>
|
1317
|
+
<p>]the (relative) position where the object was inserted</p>
|
1318
|
+
</div>
|
1319
|
+
|
1320
|
+
</li>
|
1321
|
+
|
1322
|
+
</ul>
|
1323
|
+
<h3>Raises:</h3>
|
1324
|
+
<ul class="raise">
|
1325
|
+
|
1326
|
+
<li>
|
1327
|
+
|
1328
|
+
|
1329
|
+
<span class='type'>(<tt>ArgumentError</tt>)</span>
|
1330
|
+
|
1331
|
+
|
1332
|
+
|
1333
|
+
</li>
|
1334
|
+
|
1335
|
+
</ul>
|
1336
|
+
|
1337
|
+
</div><table class="source_code">
|
1338
|
+
<tr>
|
1339
|
+
<td>
|
1340
|
+
<pre class="lines">
|
1341
|
+
|
1342
|
+
|
1343
|
+
326
|
1344
|
+
327
|
1345
|
+
328
|
1346
|
+
329
|
1347
|
+
330
|
1348
|
+
331
|
1349
|
+
332
|
1350
|
+
333
|
1351
|
+
334
|
1352
|
+
335
|
1353
|
+
336</pre>
|
1354
|
+
</td>
|
1355
|
+
<td>
|
1356
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 326</span>
|
1357
|
+
|
1358
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_insert_at'>insert_at</span><span class='lparen'>(</span><span class='id identifier rubyid_pos'>pos</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
|
1359
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>can only add a time to its own time_line</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_time_line'>time_line</span><span class='period'>.</span><span class='id identifier rubyid_equal?'>equal?</span> <span class='kw'>self</span>
|
1360
|
+
<span class='kw'>if</span> <span class='ivar'>@line</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
1361
|
+
<span class='ivar'>@line</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_obj'>obj</span><span class='rbracket'>]</span>
|
1362
|
+
<span class='kw'>else</span>
|
1363
|
+
<span class='id identifier rubyid_op'>op</span> <span class='op'>=</span> <span class='ivar'>@line</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_kind_of?'>kind_of?</span><span class='lparen'>(</span><span class='const'>Array</span><span class='rparen'>)</span> <span class='op'>?</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'><<</span><span class='tstring_end'>'</span></span> <span class='op'>:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span>
|
1364
|
+
<span class='ivar'>@line</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_op'>op</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_uniq!'>uniq!</span> <span class='comment'># no duplicates in same position
|
1365
|
+
</span> <span class='comment'># dup in diff position overwrites below
|
1366
|
+
</span> <span class='kw'>end</span>
|
1367
|
+
<span class='ivar'>@indices_of</span><span class='lbracket'>[</span><span class='id identifier rubyid_obj'>obj</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_pos'>pos</span>
|
1368
|
+
<span class='kw'>end</span></pre>
|
1369
|
+
</td>
|
1370
|
+
</tr>
|
1371
|
+
</table>
|
1372
|
+
</div>
|
1373
|
+
|
1374
|
+
<div class="method_details ">
|
1375
|
+
<p class="signature " id="insert_before_next-instance_method">
|
1376
|
+
|
1377
|
+
- (<tt>Fixnum</tt>) <strong>insert_before_next</strong>(relative_obj, obj, relative_offset = 1)
|
1378
|
+
|
1379
|
+
|
1380
|
+
|
1381
|
+
</p><div class="docstring">
|
1382
|
+
<div class="discussion">
|
1383
|
+
|
1384
|
+
<p>inserts into a new space before the relative object (first parameter)
|
1385
|
+
inserts obj before relative_obj by offset</p>
|
1386
|
+
|
1387
|
+
|
1388
|
+
</div>
|
1389
|
+
</div>
|
1390
|
+
<div class="tags">
|
1391
|
+
<h3>Parameters:</h3>
|
1392
|
+
<ul class="param">
|
1393
|
+
|
1394
|
+
<li>
|
1395
|
+
|
1396
|
+
<span class='name'>relative_obj</span>
|
1397
|
+
|
1398
|
+
|
1399
|
+
<span class='type'></span>
|
1400
|
+
|
1401
|
+
|
1402
|
+
|
1403
|
+
—
|
1404
|
+
<div class='inline'>
|
1405
|
+
<p>object for computing position where obj is inserted</p>
|
1406
|
+
</div>
|
1407
|
+
|
1408
|
+
</li>
|
1409
|
+
|
1410
|
+
<li>
|
1411
|
+
|
1412
|
+
<span class='name'>the</span>
|
1413
|
+
|
1414
|
+
|
1415
|
+
<span class='type'></span>
|
1416
|
+
|
1417
|
+
|
1418
|
+
|
1419
|
+
—
|
1420
|
+
<div class='inline'>
|
1421
|
+
<p>inserted object</p>
|
1422
|
+
</div>
|
1423
|
+
|
1424
|
+
</li>
|
1425
|
+
|
1426
|
+
</ul>
|
1427
|
+
|
1428
|
+
<h3>Returns:</h3>
|
1429
|
+
<ul class="return">
|
1430
|
+
|
1431
|
+
<li>
|
1432
|
+
|
1433
|
+
|
1434
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1435
|
+
|
1436
|
+
|
1437
|
+
|
1438
|
+
—
|
1439
|
+
<div class='inline'>
|
1440
|
+
<p>]the (relative) position where the object was inserted</p>
|
1441
|
+
</div>
|
1442
|
+
|
1443
|
+
</li>
|
1444
|
+
|
1445
|
+
</ul>
|
1446
|
+
|
1447
|
+
</div><table class="source_code">
|
1448
|
+
<tr>
|
1449
|
+
<td>
|
1450
|
+
<pre class="lines">
|
1451
|
+
|
1452
|
+
|
1453
|
+
315
|
1454
|
+
316
|
1455
|
+
317
|
1456
|
+
318
|
1457
|
+
319
|
1458
|
+
320</pre>
|
1459
|
+
</td>
|
1460
|
+
<td>
|
1461
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 315</span>
|
1462
|
+
|
1463
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_insert_before_next'>insert_before_next</span><span class='lparen'>(</span><span class='id identifier rubyid_relative_obj'>relative_obj</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='comma'>,</span> <span class='id identifier rubyid_relative_offset'>relative_offset</span><span class='op'>=</span><span class='int'>1</span><span class='rparen'>)</span>
|
1464
|
+
<span class='id identifier rubyid_relative_position'>relative_position</span> <span class='op'>=</span> <span class='id identifier rubyid_position_of'>position_of</span><span class='lparen'>(</span><span class='id identifier rubyid_relative_obj'>relative_obj</span><span class='rparen'>)</span>
|
1465
|
+
<span class='id identifier rubyid_increase_after'>increase_after</span><span class='lparen'>(</span><span class='id identifier rubyid_relative_position'>relative_position</span> <span class='op'>+</span> <span class='id identifier rubyid_relative_offset'>relative_offset</span><span class='comma'>,</span> <span class='id identifier rubyid_relative_offset'>relative_offset</span><span class='rparen'>)</span>
|
1466
|
+
<span class='ivar'>@line</span><span class='lbracket'>[</span><span class='id identifier rubyid_relative_position'>relative_position</span> <span class='op'>+</span> <span class='id identifier rubyid_relative_offset'>relative_offset</span><span class='comma'>,</span><span class='int'>0</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1467
|
+
<span class='id identifier rubyid_insert_at'>insert_at</span><span class='lparen'>(</span><span class='id identifier rubyid_relative_position'>relative_position</span><span class='op'>+</span><span class='id identifier rubyid_relative_offset'>relative_offset</span><span class='comma'>,</span> <span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
|
1468
|
+
<span class='kw'>end</span></pre>
|
1469
|
+
</td>
|
1470
|
+
</tr>
|
1471
|
+
</table>
|
1472
|
+
</div>
|
1473
|
+
|
1474
|
+
<div class="method_details ">
|
1475
|
+
<p class="signature " id="inspect-instance_method">
|
1476
|
+
|
1477
|
+
- (<tt>String</tt>) <strong>inspect</strong>
|
1478
|
+
|
1479
|
+
|
1480
|
+
|
1481
|
+
</p><div class="docstring">
|
1482
|
+
<div class="discussion">
|
1483
|
+
|
1484
|
+
<p>endpoint statuses for all TimeSpans on the TimeLine, plus TimeLine name</p>
|
1485
|
+
|
1486
|
+
|
1487
|
+
</div>
|
1488
|
+
</div>
|
1489
|
+
<div class="tags">
|
1490
|
+
|
1491
|
+
<h3>Returns:</h3>
|
1492
|
+
<ul class="return">
|
1493
|
+
|
1494
|
+
<li>
|
1495
|
+
|
1496
|
+
|
1497
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1498
|
+
|
1499
|
+
|
1500
|
+
|
1501
|
+
—
|
1502
|
+
<div class='inline'>
|
1503
|
+
<p>TimeSpan endpoint statuses + TimeLine name</p>
|
1504
|
+
</div>
|
1505
|
+
|
1506
|
+
</li>
|
1507
|
+
|
1508
|
+
</ul>
|
1509
|
+
|
1510
|
+
</div><table class="source_code">
|
1511
|
+
<tr>
|
1512
|
+
<td>
|
1513
|
+
<pre class="lines">
|
1514
|
+
|
1515
|
+
|
1516
|
+
256
|
1517
|
+
257
|
1518
|
+
258</pre>
|
1519
|
+
</td>
|
1520
|
+
<td>
|
1521
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 256</span>
|
1522
|
+
|
1523
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_inspect'>inspect</span>
|
1524
|
+
<span class='id identifier rubyid_line'>line</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span> <span class='op'>+</span> <span class='id identifier rubyid_name'>name</span>
|
1525
|
+
<span class='kw'>end</span></pre>
|
1526
|
+
</td>
|
1527
|
+
</tr>
|
1528
|
+
</table>
|
1529
|
+
</div>
|
1530
|
+
|
1531
|
+
<div class="method_details ">
|
1532
|
+
<p class="signature " id="position_of-instance_method">
|
1533
|
+
|
1534
|
+
- (<tt>Fixnum</tt>) <strong>position_of</strong>(obj)
|
1535
|
+
|
1536
|
+
|
1537
|
+
|
1538
|
+
</p><div class="docstring">
|
1539
|
+
<div class="discussion">
|
1540
|
+
|
1541
|
+
<p>find the position of a RelativeTime on the TimeLine</p>
|
1542
|
+
|
1543
|
+
|
1544
|
+
</div>
|
1545
|
+
</div>
|
1546
|
+
<div class="tags">
|
1547
|
+
|
1548
|
+
<h3>Returns:</h3>
|
1549
|
+
<ul class="return">
|
1550
|
+
|
1551
|
+
<li>
|
1552
|
+
|
1553
|
+
|
1554
|
+
<span class='type'>(<tt>Fixnum</tt>)</span>
|
1555
|
+
|
1556
|
+
|
1557
|
+
|
1558
|
+
—
|
1559
|
+
<div class='inline'>
|
1560
|
+
<p>RelativeTime's position on the TimeLine (self)</p>
|
1561
|
+
</div>
|
1562
|
+
|
1563
|
+
</li>
|
1564
|
+
|
1565
|
+
</ul>
|
1566
|
+
|
1567
|
+
</div><table class="source_code">
|
1568
|
+
<tr>
|
1569
|
+
<td>
|
1570
|
+
<pre class="lines">
|
1571
|
+
|
1572
|
+
|
1573
|
+
281
|
1574
|
+
282
|
1575
|
+
283</pre>
|
1576
|
+
</td>
|
1577
|
+
<td>
|
1578
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 281</span>
|
1579
|
+
|
1580
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_position_of'>position_of</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
|
1581
|
+
<span class='ivar'>@indices_of</span><span class='lbracket'>[</span><span class='id identifier rubyid_obj'>obj</span><span class='rbracket'>]</span>
|
1582
|
+
<span class='kw'>end</span></pre>
|
1583
|
+
</td>
|
1584
|
+
</tr>
|
1585
|
+
</table>
|
1586
|
+
</div>
|
1587
|
+
|
1588
|
+
<div class="method_details ">
|
1589
|
+
<p class="signature " id="relative_times-instance_method">
|
1590
|
+
|
1591
|
+
- (<tt>Array</tt>) <strong>relative_times</strong>
|
1592
|
+
|
1593
|
+
|
1594
|
+
|
1595
|
+
</p><div class="docstring">
|
1596
|
+
<div class="discussion">
|
1597
|
+
|
1598
|
+
<p>attached times only (internal API)</p>
|
621
1599
|
|
1600
|
+
|
1601
|
+
</div>
|
1602
|
+
</div>
|
1603
|
+
<div class="tags">
|
1604
|
+
|
1605
|
+
<h3>Returns:</h3>
|
1606
|
+
<ul class="return">
|
1607
|
+
|
1608
|
+
<li>
|
1609
|
+
|
1610
|
+
|
1611
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
622
1612
|
|
623
|
-
|
1613
|
+
|
1614
|
+
|
1615
|
+
—
|
1616
|
+
<div class='inline'>
|
1617
|
+
<p>indices of keys</p>
|
1618
|
+
</div>
|
1619
|
+
|
1620
|
+
</li>
|
1621
|
+
|
1622
|
+
</ul>
|
1623
|
+
|
1624
|
+
</div><table class="source_code">
|
1625
|
+
<tr>
|
1626
|
+
<td>
|
1627
|
+
<pre class="lines">
|
1628
|
+
|
1629
|
+
|
1630
|
+
267
|
1631
|
+
268
|
1632
|
+
269</pre>
|
1633
|
+
</td>
|
1634
|
+
<td>
|
1635
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 267</span>
|
1636
|
+
|
1637
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_relative_times'>relative_times</span>
|
1638
|
+
<span class='id identifier rubyid_indices_of'>indices_of</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span>
|
1639
|
+
<span class='kw'>end</span></pre>
|
1640
|
+
</td>
|
1641
|
+
</tr>
|
1642
|
+
</table>
|
1643
|
+
</div>
|
624
1644
|
|
625
|
-
|
1645
|
+
<div class="method_details ">
|
1646
|
+
<p class="signature " id="remove-instance_method">
|
626
1647
|
|
1648
|
+
- (<tt>Object</tt>) <strong>remove</strong>(obj)
|
1649
|
+
|
1650
|
+
|
1651
|
+
|
1652
|
+
</p><div class="docstring">
|
1653
|
+
<div class="discussion">
|
1654
|
+
|
1655
|
+
<p>cannot remove [] or the @indices_of will be wrong call #compress to remove
|
1656
|
+
the extra []s</p>
|
627
1657
|
|
628
|
-
</div><!-- documentation -->
|
629
1658
|
|
630
|
-
<div id="validator-badges">
|
631
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
632
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
633
|
-
Rdoc Generator</a> 2</small>.</p>
|
634
1659
|
</div>
|
1660
|
+
</div>
|
1661
|
+
<div class="tags">
|
1662
|
+
<h3>Parameters:</h3>
|
1663
|
+
<ul class="param">
|
1664
|
+
|
1665
|
+
<li>
|
1666
|
+
|
1667
|
+
<span class='name'>obj</span>
|
1668
|
+
|
1669
|
+
|
1670
|
+
<span class='type'></span>
|
1671
|
+
|
1672
|
+
|
1673
|
+
|
1674
|
+
—
|
1675
|
+
<div class='inline'>
|
1676
|
+
<p>object to be removed from the TimeLIne</p>
|
1677
|
+
</div>
|
1678
|
+
|
1679
|
+
</li>
|
1680
|
+
|
1681
|
+
</ul>
|
1682
|
+
|
1683
|
+
<h3>Returns:</h3>
|
1684
|
+
<ul class="return">
|
1685
|
+
|
1686
|
+
<li>
|
1687
|
+
|
1688
|
+
|
1689
|
+
<span class='type'></span>
|
1690
|
+
|
1691
|
+
|
1692
|
+
|
1693
|
+
|
1694
|
+
<div class='inline'><dl class="rdoc-list"><dt>]nil|Fixnum</dt>
|
1695
|
+
<dd>
|
1696
|
+
<p>position of deleted object</p>
|
1697
|
+
</dd></dl>
|
1698
|
+
</div>
|
1699
|
+
|
1700
|
+
</li>
|
1701
|
+
|
1702
|
+
</ul>
|
1703
|
+
|
1704
|
+
</div><table class="source_code">
|
1705
|
+
<tr>
|
1706
|
+
<td>
|
1707
|
+
<pre class="lines">
|
1708
|
+
|
1709
|
+
|
1710
|
+
342
|
1711
|
+
343
|
1712
|
+
344
|
1713
|
+
345
|
1714
|
+
346
|
1715
|
+
347
|
1716
|
+
348</pre>
|
1717
|
+
</td>
|
1718
|
+
<td>
|
1719
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 342</span>
|
1720
|
+
|
1721
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
|
1722
|
+
<span class='id identifier rubyid_pos'>pos</span> <span class='op'>=</span> <span class='id identifier rubyid_position_of'>position_of</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
|
1723
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_pos'>pos</span> <span class='comment'># do nothing if it isn't there'
|
1724
|
+
</span> <span class='ivar'>@line</span><span class='lbracket'>[</span><span class='id identifier rubyid_pos'>pos</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span> <span class='comment'># remove from list
|
1725
|
+
</span> <span class='ivar'>@indices_of</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span> <span class='comment'># remove from index
|
1726
|
+
</span> <span class='kw'>end</span>
|
1727
|
+
<span class='kw'>end</span></pre>
|
1728
|
+
</td>
|
1729
|
+
</tr>
|
1730
|
+
</table>
|
1731
|
+
</div>
|
1732
|
+
|
1733
|
+
<div class="method_details ">
|
1734
|
+
<p class="signature " id="to_s-instance_method">
|
1735
|
+
|
1736
|
+
- (<tt>String</tt>) <strong>to_s</strong>
|
1737
|
+
|
635
1738
|
|
636
|
-
|
637
|
-
</
|
1739
|
+
|
1740
|
+
</p><div class="docstring">
|
1741
|
+
<div class="discussion">
|
1742
|
+
|
1743
|
+
<p>returns the TimeLine's name</p>
|
638
1744
|
|
1745
|
+
|
1746
|
+
</div>
|
1747
|
+
</div>
|
1748
|
+
<div class="tags">
|
1749
|
+
|
1750
|
+
<h3>Returns:</h3>
|
1751
|
+
<ul class="return">
|
1752
|
+
|
1753
|
+
<li>
|
1754
|
+
|
1755
|
+
|
1756
|
+
<span class='type'>(<tt>String</tt>)</span>
|
1757
|
+
|
1758
|
+
|
1759
|
+
|
1760
|
+
—
|
1761
|
+
<div class='inline'>
|
1762
|
+
<p>TimeLine's name'</p>
|
1763
|
+
</div>
|
1764
|
+
|
1765
|
+
</li>
|
1766
|
+
|
1767
|
+
</ul>
|
1768
|
+
|
1769
|
+
</div><table class="source_code">
|
1770
|
+
<tr>
|
1771
|
+
<td>
|
1772
|
+
<pre class="lines">
|
1773
|
+
|
1774
|
+
|
1775
|
+
250
|
1776
|
+
251
|
1777
|
+
252</pre>
|
1778
|
+
</td>
|
1779
|
+
<td>
|
1780
|
+
<pre class="code"><span class="info file"># File 'lib/time_span.rb', line 250</span>
|
1781
|
+
|
1782
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_to_s'>to_s</span>
|
1783
|
+
<span class='id identifier rubyid_name'>name</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
1784
|
+
<span class='kw'>end</span></pre>
|
1785
|
+
</td>
|
1786
|
+
</tr>
|
1787
|
+
</table>
|
1788
|
+
</div>
|
1789
|
+
|
1790
|
+
</div>
|
1791
|
+
|
1792
|
+
</div>
|
1793
|
+
|
1794
|
+
<div id="footer">
|
1795
|
+
Generated on Fri Mar 2 13:34:26 2012 by
|
1796
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
1797
|
+
0.7.5 (ruby-1.9.3).
|
1798
|
+
</div>
|
1799
|
+
|
1800
|
+
</body>
|
1801
|
+
</html>
|