spoonerize 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/ruby.yml +24 -0
- data/.gitignore +1 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/README.md +106 -0
- data/Rakefile +19 -0
- data/_config.yml +1 -0
- data/bin/spoonerize +5 -0
- data/doc/README_md.html +200 -0
- data/doc/Spoonerize/Bumper.html +287 -0
- data/doc/Spoonerize/Cli.html +544 -0
- data/doc/Spoonerize/Log.html +362 -0
- data/doc/Spoonerize/Spoonerism.html +590 -0
- data/doc/Spoonerize.html +125 -0
- data/doc/created.rid +8 -0
- data/doc/css/fonts.css +167 -0
- data/doc/css/rdoc.css +619 -0
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +203 -0
- data/doc/js/darkfish.js +84 -0
- data/doc/js/navigation.js +105 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +110 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +229 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +242 -0
- data/lib/config/lazy_words.yml +21 -0
- data/lib/spoonerize/bumper.rb +61 -0
- data/lib/spoonerize/cli.rb +158 -0
- data/lib/spoonerize/log.rb +68 -0
- data/lib/spoonerize/spoonerism.rb +166 -0
- data/lib/spoonerize/version.rb +5 -0
- data/lib/spoonerize.rb +21 -0
- data/pkg/spoonerize-0.0.7.gem +0 -0
- data/spoonerize.gemspec +38 -0
- metadata +154 -0
@@ -0,0 +1,590 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Spoonerize::Spoonerism - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
var index_rel_prefix = "../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../js/navigation.js" defer></script>
|
15
|
+
<script src="../js/search.js" defer></script>
|
16
|
+
<script src="../js/search_index.js" defer></script>
|
17
|
+
<script src="../js/searcher.js" defer></script>
|
18
|
+
<script src="../js/darkfish.js" defer></script>
|
19
|
+
|
20
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
21
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
<body id="top" role="document" class="class">
|
27
|
+
<nav role="navigation">
|
28
|
+
<div id="project-navigation">
|
29
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
30
|
+
<h2>
|
31
|
+
<a href="../index.html" rel="home">Home</a>
|
32
|
+
</h2>
|
33
|
+
|
34
|
+
<div id="table-of-contents-navigation">
|
35
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
36
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
37
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
42
|
+
<form action="#" method="get" accept-charset="utf-8">
|
43
|
+
<div id="search-field-wrapper">
|
44
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
45
|
+
aria-autocomplete="list" aria-controls="search-results"
|
46
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
47
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<ul id="search-results" aria-label="Search Results"
|
51
|
+
aria-busy="false" aria-expanded="false"
|
52
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
53
|
+
</form>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
<div id="class-metadata">
|
61
|
+
|
62
|
+
<div id="parent-class-section" class="nav-section">
|
63
|
+
<h3>Parent</h3>
|
64
|
+
|
65
|
+
|
66
|
+
<p class="link">Object
|
67
|
+
|
68
|
+
</div>
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
<!-- Method Quickref -->
|
73
|
+
<div id="method-list-section" class="nav-section">
|
74
|
+
<h3>Methods</h3>
|
75
|
+
|
76
|
+
<ul class="link-list" role="directory">
|
77
|
+
|
78
|
+
<li ><a href="#method-c-new">::new</a>
|
79
|
+
|
80
|
+
<li ><a href="#method-i-all_excluded_words">#all_excluded_words</a>
|
81
|
+
|
82
|
+
<li ><a href="#method-i-enough_flippable_words-3F">#enough_flippable_words?</a>
|
83
|
+
|
84
|
+
<li ><a href="#method-i-lazy-3F">#lazy?</a>
|
85
|
+
|
86
|
+
<li ><a href="#method-i-reverse-3F">#reverse?</a>
|
87
|
+
|
88
|
+
<li ><a href="#method-i-save">#save</a>
|
89
|
+
|
90
|
+
<li ><a href="#method-i-spoonerize">#spoonerize</a>
|
91
|
+
|
92
|
+
<li ><a href="#method-i-to_h">#to_h</a>
|
93
|
+
|
94
|
+
<li ><a href="#method-i-to_json">#to_json</a>
|
95
|
+
|
96
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
97
|
+
|
98
|
+
</ul>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
</nav>
|
103
|
+
|
104
|
+
<main role="main" aria-labelledby="class-Spoonerize::Spoonerism">
|
105
|
+
<h1 id="class-Spoonerize::Spoonerism" class="class">
|
106
|
+
class Spoonerize::Spoonerism
|
107
|
+
</h1>
|
108
|
+
|
109
|
+
<section class="description">
|
110
|
+
|
111
|
+
<p>The main word-flipper.</p>
|
112
|
+
|
113
|
+
</section>
|
114
|
+
|
115
|
+
|
116
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<section class="attribute-method-details" class="method-section">
|
125
|
+
<header>
|
126
|
+
<h3>Attributes</h3>
|
127
|
+
</header>
|
128
|
+
|
129
|
+
|
130
|
+
<div id="attribute-i-excluded_words" class="method-detail">
|
131
|
+
<div class="method-heading attribute-method-heading">
|
132
|
+
<span class="method-name">excluded_words</span><span
|
133
|
+
class="attribute-access-type">[RW]</span>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<div class="method-description">
|
137
|
+
|
138
|
+
<p>The words that are to be excluded.</p>
|
139
|
+
|
140
|
+
<p>@param [Array] words</p>
|
141
|
+
|
142
|
+
<p>@return [Array]</p>
|
143
|
+
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
<div id="attribute-i-lazy" class="method-detail">
|
148
|
+
<div class="method-heading attribute-method-heading">
|
149
|
+
<span class="method-name">lazy</span><span
|
150
|
+
class="attribute-access-type">[W]</span>
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div class="method-description">
|
154
|
+
|
155
|
+
<p>This boolean determines if flipping should be performed lazily.</p>
|
156
|
+
|
157
|
+
<p>@param [Boolean] true if should be lazy.</p>
|
158
|
+
|
159
|
+
<p>@return [Boolean]</p>
|
160
|
+
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
<div id="attribute-i-logfile_name" class="method-detail">
|
165
|
+
<div class="method-heading attribute-method-heading">
|
166
|
+
<span class="method-name">logfile_name</span><span
|
167
|
+
class="attribute-access-type">[RW]</span>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div class="method-description">
|
171
|
+
|
172
|
+
<p>The full path to the log file.</p>
|
173
|
+
|
174
|
+
<p>@param [String] file</p>
|
175
|
+
|
176
|
+
<p>@return [String]</p>
|
177
|
+
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
|
181
|
+
<div id="attribute-i-reverse" class="method-detail">
|
182
|
+
<div class="method-heading attribute-method-heading">
|
183
|
+
<span class="method-name">reverse</span><span
|
184
|
+
class="attribute-access-type">[W]</span>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div class="method-description">
|
188
|
+
|
189
|
+
<p>This boolean determines if flipping should be reversed.</p>
|
190
|
+
|
191
|
+
<p>@param [Boolean] true if should be reversed.</p>
|
192
|
+
|
193
|
+
<p>@return [Boolean]</p>
|
194
|
+
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
<div id="attribute-i-words" class="method-detail">
|
199
|
+
<div class="method-heading attribute-method-heading">
|
200
|
+
<span class="method-name">words</span><span
|
201
|
+
class="attribute-access-type">[R]</span>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
<div class="method-description">
|
205
|
+
|
206
|
+
<p>The words originally passed at initialization.</p>
|
207
|
+
|
208
|
+
<p>@return [Array]</p>
|
209
|
+
|
210
|
+
</div>
|
211
|
+
</div>
|
212
|
+
|
213
|
+
</section>
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
218
|
+
<header>
|
219
|
+
<h3>Public Class Methods</h3>
|
220
|
+
</header>
|
221
|
+
|
222
|
+
|
223
|
+
<div id="method-c-new" class="method-detail ">
|
224
|
+
|
225
|
+
<div class="method-heading">
|
226
|
+
<span class="method-name">new</span><span
|
227
|
+
class="method-args">(words) { |self| ... }</span>
|
228
|
+
|
229
|
+
<span class="method-click-advice">click to toggle source</span>
|
230
|
+
|
231
|
+
</div>
|
232
|
+
|
233
|
+
|
234
|
+
<div class="method-description">
|
235
|
+
|
236
|
+
<p>Initialize instance and raise if there aren't enough words to flip.</p>
|
237
|
+
|
238
|
+
<p>@param [Array] words</p>
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
<div class="method-source-code" id="new-source">
|
244
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 48</span>
|
245
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">words</span>)
|
246
|
+
<span class="ruby-ivar">@excluded_words</span> = []
|
247
|
+
<span class="ruby-ivar">@words</span> = <span class="ruby-identifier">words</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&</span><span class="ruby-value">:downcase</span>)
|
248
|
+
<span class="ruby-ivar">@lazy</span> = <span class="ruby-keyword">false</span>
|
249
|
+
<span class="ruby-ivar">@reverse</span> = <span class="ruby-keyword">false</span>
|
250
|
+
<span class="ruby-ivar">@logfile_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(
|
251
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-string">'HOME'</span>], <span class="ruby-string">'.cache'</span>, <span class="ruby-string">'spoonerize'</span>, <span class="ruby-string">'spoonerize.csv'</span>)
|
252
|
+
)
|
253
|
+
<span class="ruby-keyword">yield</span> <span class="ruby-keyword">self</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">block_given?</span>
|
254
|
+
<span class="ruby-keyword">end</span></pre>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
</div>
|
263
|
+
|
264
|
+
|
265
|
+
</section>
|
266
|
+
|
267
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
268
|
+
<header>
|
269
|
+
<h3>Public Instance Methods</h3>
|
270
|
+
</header>
|
271
|
+
|
272
|
+
|
273
|
+
<div id="method-i-all_excluded_words" class="method-detail ">
|
274
|
+
|
275
|
+
<div class="method-heading">
|
276
|
+
<span class="method-name">all_excluded_words</span><span
|
277
|
+
class="method-args">()</span>
|
278
|
+
|
279
|
+
<span class="method-click-advice">click to toggle source</span>
|
280
|
+
|
281
|
+
</div>
|
282
|
+
|
283
|
+
|
284
|
+
<div class="method-description">
|
285
|
+
|
286
|
+
<p>Returns an array of words to exclude by combining three arrays:</p>
|
287
|
+
<ul><li>
|
288
|
+
<p>Any word in the passed arguments that's only one character</p>
|
289
|
+
</li><li>
|
290
|
+
<p>Any user-passed words, stored in <code>excluded_words</code></p>
|
291
|
+
</li><li>
|
292
|
+
<p>If lazy-mode, the LAZY_WORDS from yaml file are added</p>
|
293
|
+
</li></ul>
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
<div class="method-source-code" id="all_excluded_words-source">
|
299
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 114</span>
|
300
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">all_excluded_words</span>
|
301
|
+
(<span class="ruby-identifier">excluded_words</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">lazy?</span> <span class="ruby-operator">?</span> <span class="ruby-constant">LAZY_WORDS</span> <span class="ruby-operator">:</span> [])).<span class="ruby-identifier">map</span>(<span class="ruby-operator">&</span><span class="ruby-value">:downcase</span>)
|
302
|
+
<span class="ruby-keyword">end</span></pre>
|
303
|
+
</div>
|
304
|
+
|
305
|
+
</div>
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
</div>
|
311
|
+
|
312
|
+
|
313
|
+
<div id="method-i-enough_flippable_words-3F" class="method-detail ">
|
314
|
+
|
315
|
+
<div class="method-heading">
|
316
|
+
<span class="method-name">enough_flippable_words?</span><span
|
317
|
+
class="method-args">()</span>
|
318
|
+
|
319
|
+
<span class="method-click-advice">click to toggle source</span>
|
320
|
+
|
321
|
+
</div>
|
322
|
+
|
323
|
+
|
324
|
+
<div class="method-description">
|
325
|
+
|
326
|
+
<p>Returns true if there are more than one non-excluded word to flip</p>
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
<div class="method-source-code" id="enough_flippable_words-3F-source">
|
332
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 87</span>
|
333
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">enough_flippable_words?</span>
|
334
|
+
(<span class="ruby-identifier">words</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">all_excluded_words</span>).<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
|
335
|
+
<span class="ruby-keyword">end</span></pre>
|
336
|
+
</div>
|
337
|
+
|
338
|
+
</div>
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
</div>
|
344
|
+
|
345
|
+
|
346
|
+
<div id="method-i-lazy-3F" class="method-detail ">
|
347
|
+
|
348
|
+
<div class="method-heading">
|
349
|
+
<span class="method-name">lazy?</span><span
|
350
|
+
class="method-args">()</span>
|
351
|
+
|
352
|
+
<span class="method-click-advice">click to toggle source</span>
|
353
|
+
|
354
|
+
</div>
|
355
|
+
|
356
|
+
|
357
|
+
<div class="method-description">
|
358
|
+
|
359
|
+
<p>Should the lazy words be excluded?</p>
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
<div class="method-source-code" id="lazy-3F-source">
|
365
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 93</span>
|
366
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">lazy?</span>
|
367
|
+
<span class="ruby-ivar">@lazy</span>
|
368
|
+
<span class="ruby-keyword">end</span></pre>
|
369
|
+
</div>
|
370
|
+
|
371
|
+
</div>
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
</div>
|
377
|
+
|
378
|
+
|
379
|
+
<div id="method-i-reverse-3F" class="method-detail ">
|
380
|
+
|
381
|
+
<div class="method-heading">
|
382
|
+
<span class="method-name">reverse?</span><span
|
383
|
+
class="method-args">()</span>
|
384
|
+
|
385
|
+
<span class="method-click-advice">click to toggle source</span>
|
386
|
+
|
387
|
+
</div>
|
388
|
+
|
389
|
+
|
390
|
+
<div class="method-description">
|
391
|
+
|
392
|
+
<p>Should the words flip the other direction?</p>
|
393
|
+
|
394
|
+
|
395
|
+
|
396
|
+
|
397
|
+
<div class="method-source-code" id="reverse-3F-source">
|
398
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 99</span>
|
399
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">reverse?</span>
|
400
|
+
<span class="ruby-ivar">@reverse</span>
|
401
|
+
<span class="ruby-keyword">end</span></pre>
|
402
|
+
</div>
|
403
|
+
|
404
|
+
</div>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
</div>
|
410
|
+
|
411
|
+
|
412
|
+
<div id="method-i-save" class="method-detail ">
|
413
|
+
|
414
|
+
<div class="method-heading">
|
415
|
+
<span class="method-name">save</span><span
|
416
|
+
class="method-args">()</span>
|
417
|
+
|
418
|
+
<span class="method-click-advice">click to toggle source</span>
|
419
|
+
|
420
|
+
</div>
|
421
|
+
|
422
|
+
|
423
|
+
<div class="method-description">
|
424
|
+
|
425
|
+
<p>Saves the flipped words to the log file, along with the options</p>
|
426
|
+
|
427
|
+
|
428
|
+
|
429
|
+
|
430
|
+
<div class="method-source-code" id="save-source">
|
431
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 105</span>
|
432
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">save</span>
|
433
|
+
<span class="ruby-identifier">log</span>.<span class="ruby-identifier">write</span>([<span class="ruby-identifier">words</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>), <span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">', '</span>)])
|
434
|
+
<span class="ruby-keyword">end</span></pre>
|
435
|
+
</div>
|
436
|
+
|
437
|
+
</div>
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
|
442
|
+
</div>
|
443
|
+
|
444
|
+
|
445
|
+
<div id="method-i-spoonerize" class="method-detail ">
|
446
|
+
|
447
|
+
<div class="method-heading">
|
448
|
+
<span class="method-name">spoonerize</span><span
|
449
|
+
class="method-args">()</span>
|
450
|
+
|
451
|
+
<span class="method-click-advice">click to toggle source</span>
|
452
|
+
|
453
|
+
</div>
|
454
|
+
|
455
|
+
|
456
|
+
<div class="method-description">
|
457
|
+
|
458
|
+
<p>Iterates through words array, and maps its elements to the output of flip_words. Returns results as an array.</p>
|
459
|
+
|
460
|
+
|
461
|
+
|
462
|
+
|
463
|
+
<div class="method-source-code" id="spoonerize-source">
|
464
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 62</span>
|
465
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">spoonerize</span>
|
466
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">JakPibError</span>, <span class="ruby-string">'Not enough words to flip'</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">enough_flippable_words?</span>
|
467
|
+
<span class="ruby-identifier">words</span>.<span class="ruby-identifier">map</span>.<span class="ruby-identifier">with_index</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">word</span>, <span class="ruby-identifier">idx</span><span class="ruby-operator">|</span> <span class="ruby-identifier">flip_words</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">idx</span>) }
|
468
|
+
<span class="ruby-keyword">end</span></pre>
|
469
|
+
</div>
|
470
|
+
|
471
|
+
</div>
|
472
|
+
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
</div>
|
477
|
+
|
478
|
+
|
479
|
+
<div id="method-i-to_h" class="method-detail ">
|
480
|
+
|
481
|
+
<div class="method-heading">
|
482
|
+
<span class="method-name">to_h</span><span
|
483
|
+
class="method-args">()</span>
|
484
|
+
|
485
|
+
<span class="method-click-advice">click to toggle source</span>
|
486
|
+
|
487
|
+
</div>
|
488
|
+
|
489
|
+
|
490
|
+
<div class="method-description">
|
491
|
+
|
492
|
+
<p>Returns hash of the original words mapped to their flipped counterparts.</p>
|
493
|
+
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
<div class="method-source-code" id="to_h-source">
|
498
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 75</span>
|
499
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_h</span>
|
500
|
+
<span class="ruby-constant">Hash</span>[<span class="ruby-identifier">words</span>.<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">spoonerize</span>)]
|
501
|
+
<span class="ruby-keyword">end</span></pre>
|
502
|
+
</div>
|
503
|
+
|
504
|
+
</div>
|
505
|
+
|
506
|
+
|
507
|
+
|
508
|
+
|
509
|
+
</div>
|
510
|
+
|
511
|
+
|
512
|
+
<div id="method-i-to_json" class="method-detail ">
|
513
|
+
|
514
|
+
<div class="method-heading">
|
515
|
+
<span class="method-name">to_json</span><span
|
516
|
+
class="method-args">()</span>
|
517
|
+
|
518
|
+
<span class="method-click-advice">click to toggle source</span>
|
519
|
+
|
520
|
+
</div>
|
521
|
+
|
522
|
+
|
523
|
+
<div class="method-description">
|
524
|
+
|
525
|
+
<p>Same as <a href="Spoonerism.html#method-i-to_h"><code>to_h</code></a>, but as json.</p>
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
<div class="method-source-code" id="to_json-source">
|
531
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 81</span>
|
532
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_json</span>
|
533
|
+
<span class="ruby-identifier">to_h</span>.<span class="ruby-identifier">to_json</span>
|
534
|
+
<span class="ruby-keyword">end</span></pre>
|
535
|
+
</div>
|
536
|
+
|
537
|
+
</div>
|
538
|
+
|
539
|
+
|
540
|
+
|
541
|
+
|
542
|
+
</div>
|
543
|
+
|
544
|
+
|
545
|
+
<div id="method-i-to_s" class="method-detail ">
|
546
|
+
|
547
|
+
<div class="method-heading">
|
548
|
+
<span class="method-name">to_s</span><span
|
549
|
+
class="method-args">()</span>
|
550
|
+
|
551
|
+
<span class="method-click-advice">click to toggle source</span>
|
552
|
+
|
553
|
+
</div>
|
554
|
+
|
555
|
+
|
556
|
+
<div class="method-description">
|
557
|
+
|
558
|
+
<p>Returns spoonerize array as a joined string.</p>
|
559
|
+
|
560
|
+
|
561
|
+
|
562
|
+
|
563
|
+
<div class="method-source-code" id="to_s-source">
|
564
|
+
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 69</span>
|
565
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
566
|
+
<span class="ruby-identifier">spoonerize</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
567
|
+
<span class="ruby-keyword">end</span></pre>
|
568
|
+
</div>
|
569
|
+
|
570
|
+
</div>
|
571
|
+
|
572
|
+
|
573
|
+
|
574
|
+
|
575
|
+
</div>
|
576
|
+
|
577
|
+
|
578
|
+
</section>
|
579
|
+
|
580
|
+
</section>
|
581
|
+
|
582
|
+
</main>
|
583
|
+
|
584
|
+
|
585
|
+
<footer id="validator-badges" role="contentinfo">
|
586
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
587
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
|
588
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
589
|
+
</footer>
|
590
|
+
|