contributions 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rdoc_options +16 -0
- data/Rakefile +19 -0
- data/html/Contributions.html +139 -0
- data/html/Contributions/Contributions.html +747 -0
- data/html/Contributions/Git.html +405 -0
- data/html/Contributions/GithubAPI.html +430 -0
- data/html/Contributions/RepositoryList.html +389 -0
- data/html/Contributions/StringUtils.html +514 -0
- data/html/created.rid +9 -0
- data/html/images/add.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +79 -0
- data/html/js/darkfish.js +153 -0
- data/html/js/jquery.js +18 -0
- data/html/js/navigation.js +142 -0
- data/html/js/search.js +94 -0
- data/html/js/search_index.js +1 -0
- data/html/js/searcher.js +228 -0
- data/html/rdoc.css +543 -0
- data/html/table_of_contents.html +163 -0
- data/lib/contributions/version.rb +1 -1
- metadata +49 -8
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
|
6
|
+
|
|
7
|
+
<title>class Contributions::RepositoryList - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
|
10
|
+
|
|
11
|
+
<script type="text/javascript">
|
|
12
|
+
var rdoc_rel_prefix = "../";
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<body id="top" class="class">
|
|
24
|
+
<nav id="metadata">
|
|
25
|
+
<nav id="home-section" class="section">
|
|
26
|
+
<h3 class="section-header">
|
|
27
|
+
<a href="../index.html">Home</a>
|
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
|
30
|
+
</h3>
|
|
31
|
+
</nav>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
36
|
+
<h3 class="section-header">
|
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
39
|
+
</h3>
|
|
40
|
+
</form>
|
|
41
|
+
|
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
|
43
|
+
</nav>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div id="file-metadata">
|
|
47
|
+
<nav id="file-list-section" class="section">
|
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
|
49
|
+
<ul>
|
|
50
|
+
<li>lib/contributions/repository_list.rb
|
|
51
|
+
</ul>
|
|
52
|
+
</nav>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div id="class-metadata">
|
|
58
|
+
<nav id="sections-section" class="section">
|
|
59
|
+
<h3 class="section-header">Sections</h3>
|
|
60
|
+
<ul class="link-list">
|
|
61
|
+
|
|
62
|
+
<li><a href="#5Buntitled-5D"></a></li>
|
|
63
|
+
|
|
64
|
+
<li><a href="#Public">Public</a></li>
|
|
65
|
+
|
|
66
|
+
</ul>
|
|
67
|
+
</nav>
|
|
68
|
+
|
|
69
|
+
<nav id="parent-class-section" class="section">
|
|
70
|
+
<h3 class="section-header">Parent</h3>
|
|
71
|
+
|
|
72
|
+
<p class="link">Object
|
|
73
|
+
|
|
74
|
+
</nav>
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
<!-- Method Quickref -->
|
|
78
|
+
<nav id="method-list-section" class="section">
|
|
79
|
+
<h3 class="section-header">Methods</h3>
|
|
80
|
+
|
|
81
|
+
<ul class="link-list">
|
|
82
|
+
|
|
83
|
+
<li><a href="#method-c-new">::new</a>
|
|
84
|
+
|
|
85
|
+
<li><a href="#method-i-add">#add</a>
|
|
86
|
+
|
|
87
|
+
<li><a href="#method-i-key_value_pairs">#key_value_pairs</a>
|
|
88
|
+
|
|
89
|
+
<li><a href="#method-i-only">#only</a>
|
|
90
|
+
|
|
91
|
+
<li><a href="#method-i-remove">#remove</a>
|
|
92
|
+
|
|
93
|
+
</ul>
|
|
94
|
+
</nav>
|
|
95
|
+
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<div id="project-metadata">
|
|
99
|
+
|
|
100
|
+
<nav id="classindex-section" class="section project-section">
|
|
101
|
+
<h3 class="section-header">Class and Module Index</h3>
|
|
102
|
+
|
|
103
|
+
<ul class="link-list">
|
|
104
|
+
|
|
105
|
+
<li><a href="../Contributions.html">Contributions</a>
|
|
106
|
+
|
|
107
|
+
<li><a href="../Contributions/Contributions.html">Contributions::Contributions</a>
|
|
108
|
+
|
|
109
|
+
<li><a href="../Contributions/Git.html">Contributions::Git</a>
|
|
110
|
+
|
|
111
|
+
<li><a href="../Contributions/GithubAPI.html">Contributions::GithubAPI</a>
|
|
112
|
+
|
|
113
|
+
<li><a href="../Contributions/RepositoryList.html">Contributions::RepositoryList</a>
|
|
114
|
+
|
|
115
|
+
<li><a href="../Contributions/StringUtils.html">Contributions::StringUtils</a>
|
|
116
|
+
|
|
117
|
+
</ul>
|
|
118
|
+
</nav>
|
|
119
|
+
|
|
120
|
+
</div>
|
|
121
|
+
</nav>
|
|
122
|
+
|
|
123
|
+
<div id="documentation">
|
|
124
|
+
<h1 class="class">class Contributions::RepositoryList</h1>
|
|
125
|
+
|
|
126
|
+
<div id="description" class="description">
|
|
127
|
+
|
|
128
|
+
</div><!-- description -->
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<!-- Attributes -->
|
|
142
|
+
<section id="attribute-method-details" class="method-section section">
|
|
143
|
+
<h3 class="section-header">Attributes</h3>
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
<div id="attribute-i-list" class="method-detail">
|
|
147
|
+
<div class="method-heading attribute-method-heading">
|
|
148
|
+
<span class="method-name">list</span><span
|
|
149
|
+
class="attribute-access-type">[R]</span>
|
|
150
|
+
</div>
|
|
151
|
+
|
|
152
|
+
<div class="method-description">
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
</section><!-- attribute-method-details -->
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
<!-- Methods -->
|
|
163
|
+
|
|
164
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
|
165
|
+
<h3 class="section-header">Public Class Methods</h3>
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
<div id="method-c-new" class="method-detail ">
|
|
169
|
+
|
|
170
|
+
<div class="method-heading">
|
|
171
|
+
<span class="method-name">new</span><span
|
|
172
|
+
class="method-args">(*args)</span>
|
|
173
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
<div class="method-description">
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
<div class="method-source-code" id="new-source">
|
|
184
|
+
<pre><span class="ruby-comment"># File lib/contributions/repository_list.rb, line 6</span>
|
|
185
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(*<span class="ruby-identifier">args</span>)
|
|
186
|
+
<span class="ruby-ivar">@list</span> = [<span class="ruby-identifier">args</span>].<span class="ruby-identifier">flatten</span>
|
|
187
|
+
<span class="ruby-keyword">end</span></pre>
|
|
188
|
+
</div><!-- new-source -->
|
|
189
|
+
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
</div><!-- new-method -->
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
</section><!-- public-class-method-details -->
|
|
199
|
+
|
|
200
|
+
</section><!-- 5Buntitled-5D -->
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
<section id="Public" class="documentation-section">
|
|
205
|
+
|
|
206
|
+
<div class="documentation-section-title">
|
|
207
|
+
<h2 class="section-header">
|
|
208
|
+
Public
|
|
209
|
+
</h2>
|
|
210
|
+
<span class="section-click-top">
|
|
211
|
+
<a href="#top">↑ top</a>
|
|
212
|
+
</span>
|
|
213
|
+
</div>
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
<!-- Methods -->
|
|
223
|
+
|
|
224
|
+
<section id="public-instance-Public-method-details" class="method-section section">
|
|
225
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
<div id="method-i-add" class="method-detail ">
|
|
229
|
+
|
|
230
|
+
<div class="method-heading">
|
|
231
|
+
<span class="method-name">add</span><span
|
|
232
|
+
class="method-args">(repos)</span>
|
|
233
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
<div class="method-description">
|
|
238
|
+
|
|
239
|
+
<p>Add a string or array of strings to the repository list.</p>
|
|
240
|
+
<dl class="rdoc-list note-list"><dt>repos
|
|
241
|
+
<dd>
|
|
242
|
+
<p>a string or an array of strings (each of which is a ‘username/repo’)</p>
|
|
243
|
+
</dd></dl>
|
|
244
|
+
|
|
245
|
+
<p>Returns a <a href="RepositoryList.html">RepositoryList</a></p>
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
<div class="method-source-code" id="add-source">
|
|
250
|
+
<pre><span class="ruby-comment"># File lib/contributions/repository_list.rb, line 16</span>
|
|
251
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">repos</span>)
|
|
252
|
+
<span class="ruby-ivar">@list</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">repos</span>).<span class="ruby-identifier">flatten!</span>
|
|
253
|
+
<span class="ruby-keyword">self</span>
|
|
254
|
+
<span class="ruby-keyword">end</span></pre>
|
|
255
|
+
</div><!-- add-source -->
|
|
256
|
+
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
</div><!-- add-method -->
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
<div id="method-i-key_value_pairs" class="method-detail ">
|
|
266
|
+
|
|
267
|
+
<div class="method-heading">
|
|
268
|
+
<span class="method-name">key_value_pairs</span><span
|
|
269
|
+
class="method-args">()</span>
|
|
270
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
<div class="method-description">
|
|
275
|
+
|
|
276
|
+
<p>Turn repositories into key value pairs.</p>
|
|
277
|
+
|
|
278
|
+
<p>Returns an Array of Hashes {:username, :repository}</p>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
<div class="method-source-code" id="key_value_pairs-source">
|
|
283
|
+
<pre><span class="ruby-comment"># File lib/contributions/repository_list.rb, line 24</span>
|
|
284
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">key_value_pairs</span>
|
|
285
|
+
<span class="ruby-identifier">results</span> = []
|
|
286
|
+
<span class="ruby-ivar">@list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
|
287
|
+
<span class="ruby-identifier">p</span> = <span class="ruby-identifier">e</span>.<span class="ruby-identifier">split</span>(<span class="ruby-string">'/'</span>)
|
|
288
|
+
<span class="ruby-identifier">results</span>.<span class="ruby-identifier">push</span> <span class="ruby-constant">Hash</span>[<span class="ruby-value">:username</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">p</span>[<span class="ruby-value">0</span>], <span class="ruby-value">:repository</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">p</span>[<span class="ruby-value">1</span>]]
|
|
289
|
+
<span class="ruby-keyword">end</span>
|
|
290
|
+
|
|
291
|
+
<span class="ruby-identifier">results</span>
|
|
292
|
+
<span class="ruby-keyword">end</span></pre>
|
|
293
|
+
</div><!-- key_value_pairs-source -->
|
|
294
|
+
|
|
295
|
+
</div>
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
</div><!-- key_value_pairs-method -->
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
<div id="method-i-only" class="method-detail ">
|
|
304
|
+
|
|
305
|
+
<div class="method-heading">
|
|
306
|
+
<span class="method-name">only</span><span
|
|
307
|
+
class="method-args">(repos)</span>
|
|
308
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
309
|
+
</div>
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
<div class="method-description">
|
|
313
|
+
|
|
314
|
+
<p>Replace list of repositories with the list provided.</p>
|
|
315
|
+
<dl class="rdoc-list note-list"><dt>repos
|
|
316
|
+
<dd>
|
|
317
|
+
<p>a string or an array of strings (each of which is a ‘username/repo’)</p>
|
|
318
|
+
</dd></dl>
|
|
319
|
+
|
|
320
|
+
<p>Returns a <a href="RepositoryList.html">RepositoryList</a></p>
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
<div class="method-source-code" id="only-source">
|
|
325
|
+
<pre><span class="ruby-comment"># File lib/contributions/repository_list.rb, line 40</span>
|
|
326
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">only</span>(<span class="ruby-identifier">repos</span>)
|
|
327
|
+
<span class="ruby-ivar">@list</span> = [<span class="ruby-identifier">repos</span>].<span class="ruby-identifier">flatten</span>
|
|
328
|
+
<span class="ruby-keyword">self</span>
|
|
329
|
+
<span class="ruby-keyword">end</span></pre>
|
|
330
|
+
</div><!-- only-source -->
|
|
331
|
+
|
|
332
|
+
</div>
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
</div><!-- only-method -->
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
<div id="method-i-remove" class="method-detail ">
|
|
341
|
+
|
|
342
|
+
<div class="method-heading">
|
|
343
|
+
<span class="method-name">remove</span><span
|
|
344
|
+
class="method-args">(repos)</span>
|
|
345
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
346
|
+
</div>
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
<div class="method-description">
|
|
350
|
+
|
|
351
|
+
<p>Remove a string or array of strings from the repository list.</p>
|
|
352
|
+
<dl class="rdoc-list note-list"><dt>repos
|
|
353
|
+
<dd>
|
|
354
|
+
<p>a string or an array of strings (each of which is a ‘username/repo’)</p>
|
|
355
|
+
</dd></dl>
|
|
356
|
+
|
|
357
|
+
<p>Returns a <a href="RepositoryList.html">RepositoryList</a></p>
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
<div class="method-source-code" id="remove-source">
|
|
362
|
+
<pre><span class="ruby-comment"># File lib/contributions/repository_list.rb, line 51</span>
|
|
363
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">remove</span>(<span class="ruby-identifier">repos</span>)
|
|
364
|
+
<span class="ruby-ivar">@list</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> [<span class="ruby-identifier">repos</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">e</span> }
|
|
365
|
+
<span class="ruby-keyword">self</span>
|
|
366
|
+
<span class="ruby-keyword">end</span></pre>
|
|
367
|
+
</div><!-- remove-source -->
|
|
368
|
+
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
</div><!-- remove-method -->
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
</section><!-- public-instance-method-details -->
|
|
378
|
+
|
|
379
|
+
</section><!-- Public -->
|
|
380
|
+
|
|
381
|
+
</div><!-- documentation -->
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
<footer id="validator-badges">
|
|
385
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
|
386
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
|
387
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
|
388
|
+
</footer>
|
|
389
|
+
|
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
|
6
|
+
|
|
7
|
+
<title>class Contributions::StringUtils - RDoc Documentation</title>
|
|
8
|
+
|
|
9
|
+
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
|
10
|
+
|
|
11
|
+
<script type="text/javascript">
|
|
12
|
+
var rdoc_rel_prefix = "../";
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
<body id="top" class="class">
|
|
24
|
+
<nav id="metadata">
|
|
25
|
+
<nav id="home-section" class="section">
|
|
26
|
+
<h3 class="section-header">
|
|
27
|
+
<a href="../index.html">Home</a>
|
|
28
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
|
29
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
|
30
|
+
</h3>
|
|
31
|
+
</nav>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
|
36
|
+
<h3 class="section-header">
|
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
|
39
|
+
</h3>
|
|
40
|
+
</form>
|
|
41
|
+
|
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
|
43
|
+
</nav>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div id="file-metadata">
|
|
47
|
+
<nav id="file-list-section" class="section">
|
|
48
|
+
<h3 class="section-header">Defined In</h3>
|
|
49
|
+
<ul>
|
|
50
|
+
<li>lib/contributions/string_utils.rb
|
|
51
|
+
</ul>
|
|
52
|
+
</nav>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<div id="class-metadata">
|
|
58
|
+
<nav id="sections-section" class="section">
|
|
59
|
+
<h3 class="section-header">Sections</h3>
|
|
60
|
+
<ul class="link-list">
|
|
61
|
+
|
|
62
|
+
<li><a href="#5Buntitled-5D"></a></li>
|
|
63
|
+
|
|
64
|
+
<li><a href="#Public">Public</a></li>
|
|
65
|
+
|
|
66
|
+
<li><a href="#Internal">Internal</a></li>
|
|
67
|
+
|
|
68
|
+
</ul>
|
|
69
|
+
</nav>
|
|
70
|
+
|
|
71
|
+
<nav id="parent-class-section" class="section">
|
|
72
|
+
<h3 class="section-header">Parent</h3>
|
|
73
|
+
|
|
74
|
+
<p class="link">Object
|
|
75
|
+
|
|
76
|
+
</nav>
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
<!-- Method Quickref -->
|
|
80
|
+
<nav id="method-list-section" class="section">
|
|
81
|
+
<h3 class="section-header">Methods</h3>
|
|
82
|
+
|
|
83
|
+
<ul class="link-list">
|
|
84
|
+
|
|
85
|
+
<li><a href="#method-c-practically_empty-3F">::practically_empty?</a>
|
|
86
|
+
|
|
87
|
+
<li><a href="#method-c-remove_empty">::remove_empty</a>
|
|
88
|
+
|
|
89
|
+
<li><a href="#method-c-short_dates">::short_dates</a>
|
|
90
|
+
|
|
91
|
+
<li><a href="#method-c-split-21">::split!</a>
|
|
92
|
+
|
|
93
|
+
<li><a href="#method-c-string_to_hash">::string_to_hash</a>
|
|
94
|
+
|
|
95
|
+
<li><a href="#method-c-zip_to_hash">::zip_to_hash</a>
|
|
96
|
+
|
|
97
|
+
</ul>
|
|
98
|
+
</nav>
|
|
99
|
+
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<div id="project-metadata">
|
|
103
|
+
|
|
104
|
+
<nav id="classindex-section" class="section project-section">
|
|
105
|
+
<h3 class="section-header">Class and Module Index</h3>
|
|
106
|
+
|
|
107
|
+
<ul class="link-list">
|
|
108
|
+
|
|
109
|
+
<li><a href="../Contributions.html">Contributions</a>
|
|
110
|
+
|
|
111
|
+
<li><a href="../Contributions/Contributions.html">Contributions::Contributions</a>
|
|
112
|
+
|
|
113
|
+
<li><a href="../Contributions/Git.html">Contributions::Git</a>
|
|
114
|
+
|
|
115
|
+
<li><a href="../Contributions/GithubAPI.html">Contributions::GithubAPI</a>
|
|
116
|
+
|
|
117
|
+
<li><a href="../Contributions/RepositoryList.html">Contributions::RepositoryList</a>
|
|
118
|
+
|
|
119
|
+
<li><a href="../Contributions/StringUtils.html">Contributions::StringUtils</a>
|
|
120
|
+
|
|
121
|
+
</ul>
|
|
122
|
+
</nav>
|
|
123
|
+
|
|
124
|
+
</div>
|
|
125
|
+
</nav>
|
|
126
|
+
|
|
127
|
+
<div id="documentation">
|
|
128
|
+
<h1 class="class">class Contributions::StringUtils</h1>
|
|
129
|
+
|
|
130
|
+
<div id="description" class="description">
|
|
131
|
+
|
|
132
|
+
</div><!-- description -->
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
<!-- Methods -->
|
|
147
|
+
|
|
148
|
+
</section><!-- 5Buntitled-5D -->
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
<section id="Public" class="documentation-section">
|
|
153
|
+
|
|
154
|
+
<div class="documentation-section-title">
|
|
155
|
+
<h2 class="section-header">
|
|
156
|
+
Public
|
|
157
|
+
</h2>
|
|
158
|
+
<span class="section-click-top">
|
|
159
|
+
<a href="#top">↑ top</a>
|
|
160
|
+
</span>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
<!-- Methods -->
|
|
171
|
+
|
|
172
|
+
<section id="public-class-Public-method-details" class="method-section section">
|
|
173
|
+
<h3 class="section-header">Public Class Methods</h3>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<div id="method-c-split-21" class="method-detail ">
|
|
177
|
+
|
|
178
|
+
<div class="method-heading">
|
|
179
|
+
<span class="method-name">split!</span><span
|
|
180
|
+
class="method-args">(string, separator)</span>
|
|
181
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
<div class="method-description">
|
|
186
|
+
|
|
187
|
+
<p>Split the string on the give separator.</p>
|
|
188
|
+
<dl class="rdoc-list note-list"><dt>separator
|
|
189
|
+
<dd>
|
|
190
|
+
<p>the character(s) on which to split the string.</p>
|
|
191
|
+
</dd></dl>
|
|
192
|
+
|
|
193
|
+
<p>Returns a modified version of the string.</p>
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
<div class="method-source-code" id="split-21-source">
|
|
198
|
+
<pre><span class="ruby-comment"># File lib/contributions/string_utils.rb, line 69</span>
|
|
199
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">split!</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">separator</span>)
|
|
200
|
+
<span class="ruby-identifier">string</span>.<span class="ruby-identifier">split</span>(<span class="ruby-identifier">separator</span>)
|
|
201
|
+
<span class="ruby-keyword">end</span></pre>
|
|
202
|
+
</div><!-- split-21-source -->
|
|
203
|
+
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
</div><!-- split-21-method -->
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
<div id="method-c-string_to_hash" class="method-detail ">
|
|
213
|
+
|
|
214
|
+
<div class="method-heading">
|
|
215
|
+
<span class="method-name">string_to_hash</span><span
|
|
216
|
+
class="method-args">(string, keys, separator, *ending)</span>
|
|
217
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
<div class="method-description">
|
|
222
|
+
|
|
223
|
+
<p>Read a long string of commit data and turn it into a hash.</p>
|
|
224
|
+
<dl class="rdoc-list note-list"><dt>string
|
|
225
|
+
<dd>
|
|
226
|
+
<p>a string of commit data.</p>
|
|
227
|
+
</dd><dt>separator
|
|
228
|
+
<dd>
|
|
229
|
+
<p>the separator between values in an entry.</p>
|
|
230
|
+
</dd><dt>ending
|
|
231
|
+
<dd>
|
|
232
|
+
<p>the separator between entries.</p>
|
|
233
|
+
</dd><dt>keys
|
|
234
|
+
<dd>
|
|
235
|
+
<p>an Array of keys for the final hash.</p>
|
|
236
|
+
</dd></dl>
|
|
237
|
+
|
|
238
|
+
<p>Returns a Hash.</p>
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
<div class="method-source-code" id="string_to_hash-source">
|
|
243
|
+
<pre><span class="ruby-comment"># File lib/contributions/string_utils.rb, line 13</span>
|
|
244
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">string_to_hash</span>(<span class="ruby-identifier">string</span>, <span class="ruby-identifier">keys</span>, <span class="ruby-identifier">separator</span>, *<span class="ruby-identifier">ending</span>)
|
|
245
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">string</span>.<span class="ruby-identifier">dup</span>
|
|
246
|
+
<span class="ruby-identifier">s_as_array</span> = <span class="ruby-identifier">ending</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">?</span> [<span class="ruby-identifier">s</span>] <span class="ruby-operator">:</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">split!</span>(<span class="ruby-identifier">s</span>, <span class="ruby-identifier">ending</span>[<span class="ruby-value">0</span>])
|
|
247
|
+
|
|
248
|
+
<span class="ruby-identifier">s_as_array</span>.<span class="ruby-identifier">map!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">split!</span>(<span class="ruby-identifier">e</span>, <span class="ruby-identifier">separator</span>) }
|
|
249
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">remove_empty</span>(<span class="ruby-identifier">s_as_array</span>)
|
|
250
|
+
|
|
251
|
+
<span class="ruby-identifier">s_as_array</span>.<span class="ruby-identifier">map!</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
|
252
|
+
<span class="ruby-identifier">e</span>.<span class="ruby-identifier">map!</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">strip</span> }
|
|
253
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">zip_to_hash</span>(<span class="ruby-identifier">keys</span>, <span class="ruby-identifier">e</span>)
|
|
254
|
+
<span class="ruby-keyword">end</span>
|
|
255
|
+
|
|
256
|
+
<span class="ruby-identifier">s_as_array</span>.<span class="ruby-identifier">map</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span>
|
|
257
|
+
<span class="ruby-keyword">self</span>.<span class="ruby-identifier">short_dates</span>(<span class="ruby-identifier">e</span>)
|
|
258
|
+
<span class="ruby-keyword">end</span>
|
|
259
|
+
|
|
260
|
+
<span class="ruby-comment"># s_as_array.map do |e|</span>
|
|
261
|
+
<span class="ruby-comment"># self.zip_to_hash(keys, e)</span>
|
|
262
|
+
<span class="ruby-comment"># end</span>
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
<span class="ruby-comment"># self.split!(s, ending).each do |e|</span>
|
|
266
|
+
<span class="ruby-comment"># self.remove_empty(self.split!(e, separator))</span>
|
|
267
|
+
<span class="ruby-comment"># end</span>
|
|
268
|
+
|
|
269
|
+
<span class="ruby-comment"># Now we need the zip move, then to a hash, then replace nils with</span>
|
|
270
|
+
<span class="ruby-comment"># ''</span>
|
|
271
|
+
|
|
272
|
+
<span class="ruby-comment"># s = string.dup</span>
|
|
273
|
+
<span class="ruby-comment"># array = string.split()</span>
|
|
274
|
+
<span class="ruby-comment"># small_arrays = array.map { |e| e.split(separator).map { |l| l.strip } }</span>
|
|
275
|
+
<span class="ruby-comment"># small_arrays.delete_if { |a| a[0] == "" and a[1] == nil }</span>
|
|
276
|
+
<span class="ruby-comment"># small_arrays.map! { |a| [:sha, :date, :subject, :body].zip a }</span>
|
|
277
|
+
<span class="ruby-comment"># small_arrays</span>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
<span class="ruby-comment"># results = []</span>
|
|
283
|
+
<span class="ruby-comment"># s = string.dup</span>
|
|
284
|
+
<span class="ruby-comment"># s.gsub!(/(\d{4}-\d{2}-\d{2})/) { |f| " BREAK " + f }</span>
|
|
285
|
+
<span class="ruby-comment"># s = s.split(" BREAK ")</span>
|
|
286
|
+
<span class="ruby-comment"># s.delete_if { |l| l.empty? }</span>
|
|
287
|
+
<span class="ruby-comment"># s.each do |line|</span>
|
|
288
|
+
<span class="ruby-comment"># m = /(?<date>\d{4}-\d{2}-\d{2})/.match line</span>
|
|
289
|
+
<span class="ruby-comment"># results.push m["date"]</span>
|
|
290
|
+
<span class="ruby-comment"># end</span>
|
|
291
|
+
|
|
292
|
+
<span class="ruby-comment"># results</span>
|
|
293
|
+
<span class="ruby-keyword">end</span></pre>
|
|
294
|
+
</div><!-- string_to_hash-source -->
|
|
295
|
+
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
</div><!-- string_to_hash-method -->
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
</section><!-- public-class-method-details -->
|
|
305
|
+
|
|
306
|
+
</section><!-- Public -->
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
<section id="Internal" class="documentation-section">
|
|
311
|
+
|
|
312
|
+
<div class="documentation-section-title">
|
|
313
|
+
<h2 class="section-header">
|
|
314
|
+
Internal
|
|
315
|
+
</h2>
|
|
316
|
+
<span class="section-click-top">
|
|
317
|
+
<a href="#top">↑ top</a>
|
|
318
|
+
</span>
|
|
319
|
+
</div>
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
<!-- Methods -->
|
|
329
|
+
|
|
330
|
+
<section id="public-class-Internal-method-details" class="method-section section">
|
|
331
|
+
<h3 class="section-header">Public Class Methods</h3>
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
<div id="method-c-practically_empty-3F" class="method-detail ">
|
|
335
|
+
|
|
336
|
+
<div class="method-heading">
|
|
337
|
+
<span class="method-name">practically_empty?</span><span
|
|
338
|
+
class="method-args">(arg)</span>
|
|
339
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
<div class="method-description">
|
|
344
|
+
|
|
345
|
+
<p>Determine whether a string has any content.</p>
|
|
346
|
+
|
|
347
|
+
<p>Examples:</p>
|
|
348
|
+
|
|
349
|
+
<pre class="ruby"><span class="ruby-constant">StringUtils</span>.<span class="ruby-identifier">practically_empty?</span>(<span class="ruby-string">''</span>)
|
|
350
|
+
<span class="ruby-comment"># => true</span>
|
|
351
|
+
<span class="ruby-constant">StringUtils</span>.<span class="ruby-identifier">practically_empty?</span>(<span class="ruby-string">"\n\n"</span>)
|
|
352
|
+
<span class="ruby-comment"># => true</span>
|
|
353
|
+
<span class="ruby-constant">StringUtils</span>.<span class="ruby-identifier">practically_empty?</span>(<span class="ruby-string">"a\n"</span>)
|
|
354
|
+
<span class="ruby-comment"># => false</span>
|
|
355
|
+
</pre>
|
|
356
|
+
|
|
357
|
+
<p>Returns a Boolean.</p>
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
<div class="method-source-code" id="practically_empty-3F-source">
|
|
362
|
+
<pre><span class="ruby-comment"># File lib/contributions/string_utils.rb, line 94</span>
|
|
363
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">practically_empty?</span>(<span class="ruby-identifier">arg</span>)
|
|
364
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">empty?</span>
|
|
365
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
|
|
366
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-operator">!</span><span class="ruby-identifier">arg</span>.<span class="ruby-identifier">match</span> <span class="ruby-regexp">%r\w/</span>
|
|
367
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span>
|
|
368
|
+
<span class="ruby-keyword">else</span>
|
|
369
|
+
<span class="ruby-keyword">return</span> <span class="ruby-keyword">false</span>
|
|
370
|
+
<span class="ruby-keyword">end</span>
|
|
371
|
+
<span class="ruby-keyword">end</span></pre>
|
|
372
|
+
</div><!-- practically_empty-3F-source -->
|
|
373
|
+
|
|
374
|
+
</div>
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
</div><!-- practically_empty-3F-method -->
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
<div id="method-c-remove_empty" class="method-detail ">
|
|
383
|
+
|
|
384
|
+
<div class="method-heading">
|
|
385
|
+
<span class="method-name">remove_empty</span><span
|
|
386
|
+
class="method-args">(array)</span>
|
|
387
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
388
|
+
</div>
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
<div class="method-description">
|
|
392
|
+
|
|
393
|
+
<p>Remove any empty arrays after a split.</p>
|
|
394
|
+
<dl class="rdoc-list note-list"><dt>array
|
|
395
|
+
<dd>
|
|
396
|
+
<p>an array of Strings.</p>
|
|
397
|
+
</dd></dl>
|
|
398
|
+
|
|
399
|
+
<p>Returns an Array of Strings (modified)</p>
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
<div class="method-source-code" id="remove_empty-source">
|
|
404
|
+
<pre><span class="ruby-comment"># File lib/contributions/string_utils.rb, line 78</span>
|
|
405
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">remove_empty</span>(<span class="ruby-identifier">array</span>)
|
|
406
|
+
<span class="ruby-identifier">array</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">practically_empty?</span>(<span class="ruby-identifier">a</span>[<span class="ruby-value">0</span>]) <span class="ruby-operator">&&</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">nil?</span> }
|
|
407
|
+
<span class="ruby-keyword">end</span></pre>
|
|
408
|
+
</div><!-- remove_empty-source -->
|
|
409
|
+
|
|
410
|
+
</div>
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
</div><!-- remove_empty-method -->
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
<div id="method-c-short_dates" class="method-detail ">
|
|
419
|
+
|
|
420
|
+
<div class="method-heading">
|
|
421
|
+
<span class="method-name">short_dates</span><span
|
|
422
|
+
class="method-args">(hash)</span>
|
|
423
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
424
|
+
</div>
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
<div class="method-description">
|
|
428
|
+
|
|
429
|
+
<p>Convert date format to a simpler one.</p>
|
|
430
|
+
<dl class="rdoc-list note-list"><dt>hash
|
|
431
|
+
<dd>
|
|
432
|
+
<p>a hash with a :date key</p>
|
|
433
|
+
</dd></dl>
|
|
434
|
+
|
|
435
|
+
<p>Returns a Hash.</p>
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
<div class="method-source-code" id="short_dates-source">
|
|
440
|
+
<pre><span class="ruby-comment"># File lib/contributions/string_utils.rb, line 126</span>
|
|
441
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">short_dates</span>(<span class="ruby-identifier">hash</span>)
|
|
442
|
+
<span class="ruby-identifier">old_date</span> = <span class="ruby-identifier">hash</span>[<span class="ruby-value">:date</span>]
|
|
443
|
+
<span class="ruby-identifier">hash</span>[<span class="ruby-value">:date</span>] = <span class="ruby-identifier">old_date</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp">%r(\d{4}-\d{2}-\d{2})/</span>)[<span class="ruby-value">1</span>]
|
|
444
|
+
|
|
445
|
+
<span class="ruby-identifier">hash</span>
|
|
446
|
+
<span class="ruby-keyword">end</span></pre>
|
|
447
|
+
</div><!-- short_dates-source -->
|
|
448
|
+
|
|
449
|
+
</div>
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
</div><!-- short_dates-method -->
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
<div id="method-c-zip_to_hash" class="method-detail ">
|
|
458
|
+
|
|
459
|
+
<div class="method-heading">
|
|
460
|
+
<span class="method-name">zip_to_hash</span><span
|
|
461
|
+
class="method-args">(keys, values)</span>
|
|
462
|
+
<span class="method-click-advice">click to toggle source</span>
|
|
463
|
+
</div>
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
<div class="method-description">
|
|
467
|
+
|
|
468
|
+
<p>Convert a pair of arrays into a hash with the first as keys.</p>
|
|
469
|
+
<dl class="rdoc-list note-list"><dt>keys
|
|
470
|
+
<dd>
|
|
471
|
+
<p>an Array of keys.</p>
|
|
472
|
+
</dd><dt>values
|
|
473
|
+
<dd>
|
|
474
|
+
<p>an Array of values.</p>
|
|
475
|
+
</dd></dl>
|
|
476
|
+
|
|
477
|
+
<p>Returns a Hash.</p>
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
<div class="method-source-code" id="zip_to_hash-source">
|
|
482
|
+
<pre><span class="ruby-comment"># File lib/contributions/string_utils.rb, line 111</span>
|
|
483
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">zip_to_hash</span>(<span class="ruby-identifier">keys</span>, <span class="ruby-identifier">values</span>)
|
|
484
|
+
<span class="ruby-identifier">value</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
|
485
|
+
<span class="ruby-identifier">zipped</span> = <span class="ruby-identifier">keys</span>.<span class="ruby-identifier">zip</span> <span class="ruby-identifier">values</span>
|
|
486
|
+
<span class="ruby-identifier">zipped</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pair</span><span class="ruby-operator">|</span>
|
|
487
|
+
<span class="ruby-identifier">value</span>[<span class="ruby-identifier">pair</span>.<span class="ruby-identifier">first</span>] = <span class="ruby-identifier">pair</span>.<span class="ruby-identifier">last</span> <span class="ruby-operator">||</span> <span class="ruby-string">''</span>
|
|
488
|
+
<span class="ruby-keyword">end</span>
|
|
489
|
+
|
|
490
|
+
<span class="ruby-identifier">value</span>
|
|
491
|
+
<span class="ruby-keyword">end</span></pre>
|
|
492
|
+
</div><!-- zip_to_hash-source -->
|
|
493
|
+
|
|
494
|
+
</div>
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
|
|
499
|
+
</div><!-- zip_to_hash-method -->
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
</section><!-- public-class-method-details -->
|
|
503
|
+
|
|
504
|
+
</section><!-- Internal -->
|
|
505
|
+
|
|
506
|
+
</div><!-- documentation -->
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
<footer id="validator-badges">
|
|
510
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
|
511
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
|
|
512
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
|
513
|
+
</footer>
|
|
514
|
+
|