spoonerize 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/README.md +2 -4
- data/Rakefile +1 -1
- data/lib/spoonerize/version.rb +1 -1
- data/spoonerize.gemspec +1 -1
- metadata +3 -53
- data/doc/README_md.html +0 -238
- data/doc/Spoonerize.html +0 -125
- data/doc/Spoonerize/Bumper.html +0 -287
- data/doc/Spoonerize/Cli.html +0 -545
- data/doc/Spoonerize/Log.html +0 -362
- data/doc/Spoonerize/Spoonerism.html +0 -759
- data/doc/created.rid +0 -8
- data/doc/css/fonts.css +0 -167
- data/doc/css/rdoc.css +0 -619
- 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 +0 -241
- data/doc/js/darkfish.js +0 -84
- data/doc/js/navigation.js +0 -105
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +0 -110
- data/doc/js/search_index.js +0 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +0 -229
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +0 -257
data/doc/Spoonerize/Log.html
DELETED
@@ -1,362 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
|
7
|
-
<title>class Spoonerize::Log - 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-contents">#contents</a>
|
81
|
-
|
82
|
-
<li ><a href="#method-i-each">#each</a>
|
83
|
-
|
84
|
-
<li ><a href="#method-i-size">#size</a>
|
85
|
-
|
86
|
-
<li ><a href="#method-i-write">#write</a>
|
87
|
-
|
88
|
-
</ul>
|
89
|
-
</div>
|
90
|
-
|
91
|
-
</div>
|
92
|
-
</nav>
|
93
|
-
|
94
|
-
<main role="main" aria-labelledby="class-Spoonerize::Log">
|
95
|
-
<h1 id="class-Spoonerize::Log" class="class">
|
96
|
-
class Spoonerize::Log
|
97
|
-
</h1>
|
98
|
-
|
99
|
-
<section class="description">
|
100
|
-
|
101
|
-
<p>Class that handles reading/writing logs.</p>
|
102
|
-
|
103
|
-
</section>
|
104
|
-
|
105
|
-
|
106
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
<section class="attribute-method-details" class="method-section">
|
115
|
-
<header>
|
116
|
-
<h3>Attributes</h3>
|
117
|
-
</header>
|
118
|
-
|
119
|
-
|
120
|
-
<div id="attribute-i-directory" class="method-detail">
|
121
|
-
<div class="method-heading attribute-method-heading">
|
122
|
-
<span class="method-name">directory</span><span
|
123
|
-
class="attribute-access-type">[R]</span>
|
124
|
-
</div>
|
125
|
-
|
126
|
-
<div class="method-description">
|
127
|
-
|
128
|
-
<p>The directory the file is located.</p>
|
129
|
-
|
130
|
-
<p>@return [String]</p>
|
131
|
-
|
132
|
-
</div>
|
133
|
-
</div>
|
134
|
-
|
135
|
-
<div id="attribute-i-file" class="method-detail">
|
136
|
-
<div class="method-heading attribute-method-heading">
|
137
|
-
<span class="method-name">file</span><span
|
138
|
-
class="attribute-access-type">[R]</span>
|
139
|
-
</div>
|
140
|
-
|
141
|
-
<div class="method-description">
|
142
|
-
|
143
|
-
<p>The file name to use.</p>
|
144
|
-
|
145
|
-
<p>@return [String]</p>
|
146
|
-
|
147
|
-
</div>
|
148
|
-
</div>
|
149
|
-
|
150
|
-
</section>
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
155
|
-
<header>
|
156
|
-
<h3>Public Class Methods</h3>
|
157
|
-
</header>
|
158
|
-
|
159
|
-
|
160
|
-
<div id="method-c-new" class="method-detail ">
|
161
|
-
|
162
|
-
<div class="method-heading">
|
163
|
-
<span class="method-name">new</span><span
|
164
|
-
class="method-args">(file)</span>
|
165
|
-
|
166
|
-
<span class="method-click-advice">click to toggle source</span>
|
167
|
-
|
168
|
-
</div>
|
169
|
-
|
170
|
-
|
171
|
-
<div class="method-description">
|
172
|
-
|
173
|
-
<p>Constructor for <a href="Log.html"><code>Log</code></a>.</p>
|
174
|
-
|
175
|
-
<p>@param [String] file</p>
|
176
|
-
|
177
|
-
<p>@return [Spoonerize::Log]</p>
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
<div class="method-source-code" id="new-source">
|
183
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/log.rb, line 27</span>
|
184
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">file</span>)
|
185
|
-
<span class="ruby-ivar">@file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">file</span>)
|
186
|
-
<span class="ruby-ivar">@directory</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">file</span>)
|
187
|
-
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">directory</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">directory</span>)
|
188
|
-
<span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">touch</span>(<span class="ruby-identifier">file</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">file</span>)
|
189
|
-
<span class="ruby-keyword">end</span></pre>
|
190
|
-
</div>
|
191
|
-
|
192
|
-
</div>
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
</div>
|
198
|
-
|
199
|
-
|
200
|
-
</section>
|
201
|
-
|
202
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
203
|
-
<header>
|
204
|
-
<h3>Public Instance Methods</h3>
|
205
|
-
</header>
|
206
|
-
|
207
|
-
|
208
|
-
<div id="method-i-contents" class="method-detail ">
|
209
|
-
|
210
|
-
<div class="method-heading">
|
211
|
-
<span class="method-name">contents</span><span
|
212
|
-
class="method-args">()</span>
|
213
|
-
|
214
|
-
<span class="method-click-advice">click to toggle source</span>
|
215
|
-
|
216
|
-
</div>
|
217
|
-
|
218
|
-
|
219
|
-
<div class="method-description">
|
220
|
-
|
221
|
-
<p>The contents of the log file.</p>
|
222
|
-
|
223
|
-
<p>@return [Array]</p>
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
<div class="method-source-code" id="contents-source">
|
229
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/log.rb, line 38</span>
|
230
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">contents</span>
|
231
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">CSV</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">file</span>)
|
232
|
-
<span class="ruby-keyword">end</span></pre>
|
233
|
-
</div>
|
234
|
-
|
235
|
-
</div>
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
</div>
|
241
|
-
|
242
|
-
|
243
|
-
<div id="method-i-each" class="method-detail ">
|
244
|
-
|
245
|
-
<div class="method-heading">
|
246
|
-
<span class="method-name">each</span><span
|
247
|
-
class="method-args">() { |row| ... }</span>
|
248
|
-
|
249
|
-
<span class="method-click-advice">click to toggle source</span>
|
250
|
-
|
251
|
-
</div>
|
252
|
-
|
253
|
-
|
254
|
-
<div class="method-description">
|
255
|
-
|
256
|
-
<p>Iterate through each line of the file.</p>
|
257
|
-
|
258
|
-
<p>@return [Array]</p>
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
<div class="method-source-code" id="each-source">
|
264
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/log.rb, line 56</span>
|
265
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each</span>
|
266
|
-
<span class="ruby-identifier">contents</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">row</span><span class="ruby-operator">|</span> <span class="ruby-keyword">yield</span> <span class="ruby-identifier">row</span> }
|
267
|
-
<span class="ruby-keyword">end</span></pre>
|
268
|
-
</div>
|
269
|
-
|
270
|
-
</div>
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
</div>
|
276
|
-
|
277
|
-
|
278
|
-
<div id="method-i-size" class="method-detail ">
|
279
|
-
|
280
|
-
<div class="method-heading">
|
281
|
-
<span class="method-name">size</span><span
|
282
|
-
class="method-args">()</span>
|
283
|
-
|
284
|
-
<span class="method-click-advice">click to toggle source</span>
|
285
|
-
|
286
|
-
</div>
|
287
|
-
|
288
|
-
|
289
|
-
<div class="method-description">
|
290
|
-
|
291
|
-
<p>Number of entries in the file.</p>
|
292
|
-
|
293
|
-
<p>@return [Integer]</p>
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
<div class="method-source-code" id="size-source">
|
299
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/log.rb, line 64</span>
|
300
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">size</span>
|
301
|
-
<span class="ruby-identifier">contents</span>.<span class="ruby-identifier">size</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-write" class="method-detail ">
|
314
|
-
|
315
|
-
<div class="method-heading">
|
316
|
-
<span class="method-name">write</span><span
|
317
|
-
class="method-args">(row)</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>Writes a line to the log.</p>
|
327
|
-
|
328
|
-
<p>@param [Array] row</p>
|
329
|
-
|
330
|
-
<p>@return [Array]</p>
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
<div class="method-source-code" id="write-source">
|
336
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/log.rb, line 48</span>
|
337
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">write</span>(<span class="ruby-identifier">row</span>)
|
338
|
-
<span class="ruby-operator">::</span><span class="ruby-constant">CSV</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file</span>, <span class="ruby-string">'a'</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">csv</span><span class="ruby-operator">|</span> <span class="ruby-identifier">csv</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">row</span> }
|
339
|
-
<span class="ruby-keyword">end</span></pre>
|
340
|
-
</div>
|
341
|
-
|
342
|
-
</div>
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
</div>
|
348
|
-
|
349
|
-
|
350
|
-
</section>
|
351
|
-
|
352
|
-
</section>
|
353
|
-
|
354
|
-
</main>
|
355
|
-
|
356
|
-
|
357
|
-
<footer id="validator-badges" role="contentinfo">
|
358
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
359
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
|
360
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
361
|
-
</footer>
|
362
|
-
|
@@ -1,759 +0,0 @@
|
|
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-config_file-3D">#config_file=</a>
|
83
|
-
|
84
|
-
<li ><a href="#method-i-config_file_loaded-3F">#config_file_loaded?</a>
|
85
|
-
|
86
|
-
<li ><a href="#method-i-enough_flippable_words-3F">#enough_flippable_words?</a>
|
87
|
-
|
88
|
-
<li ><a href="#method-i-lazy-3F">#lazy?</a>
|
89
|
-
|
90
|
-
<li ><a href="#method-i-load_config_file">#load_config_file</a>
|
91
|
-
|
92
|
-
<li ><a href="#method-i-reverse-3F">#reverse?</a>
|
93
|
-
|
94
|
-
<li ><a href="#method-i-save">#save</a>
|
95
|
-
|
96
|
-
<li ><a href="#method-i-spoonerize">#spoonerize</a>
|
97
|
-
|
98
|
-
<li ><a href="#method-i-to_h">#to_h</a>
|
99
|
-
|
100
|
-
<li ><a href="#method-i-to_json">#to_json</a>
|
101
|
-
|
102
|
-
<li ><a href="#method-i-to_s">#to_s</a>
|
103
|
-
|
104
|
-
</ul>
|
105
|
-
</div>
|
106
|
-
|
107
|
-
</div>
|
108
|
-
</nav>
|
109
|
-
|
110
|
-
<main role="main" aria-labelledby="class-Spoonerize::Spoonerism">
|
111
|
-
<h1 id="class-Spoonerize::Spoonerism" class="class">
|
112
|
-
class Spoonerize::Spoonerism
|
113
|
-
</h1>
|
114
|
-
|
115
|
-
<section class="description">
|
116
|
-
|
117
|
-
<p>The main word-flipper.</p>
|
118
|
-
|
119
|
-
</section>
|
120
|
-
|
121
|
-
|
122
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
<section class="attribute-method-details" class="method-section">
|
131
|
-
<header>
|
132
|
-
<h3>Attributes</h3>
|
133
|
-
</header>
|
134
|
-
|
135
|
-
|
136
|
-
<div id="attribute-i-config" class="method-detail">
|
137
|
-
<div class="method-heading attribute-method-heading">
|
138
|
-
<span class="method-name">config</span><span
|
139
|
-
class="attribute-access-type">[R]</span>
|
140
|
-
</div>
|
141
|
-
|
142
|
-
<div class="method-description">
|
143
|
-
|
144
|
-
<p>The options from <code>config_file</code> as a hash.</p>
|
145
|
-
|
146
|
-
<p>@return [Hash] Options from <code>config_file</code></p>
|
147
|
-
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
|
151
|
-
<div id="attribute-i-config_file" class="method-detail">
|
152
|
-
<div class="method-heading attribute-method-heading">
|
153
|
-
<span class="method-name">config_file</span><span
|
154
|
-
class="attribute-access-type">[R]</span>
|
155
|
-
</div>
|
156
|
-
|
157
|
-
<div class="method-description">
|
158
|
-
|
159
|
-
<p>The configuration file. Default is <code>nil</code>. If set to a string, and the file exists, it is used to set options.</p>
|
160
|
-
|
161
|
-
<p>@return [String] file path</p>
|
162
|
-
|
163
|
-
</div>
|
164
|
-
</div>
|
165
|
-
|
166
|
-
<div id="attribute-i-excluded_words" class="method-detail">
|
167
|
-
<div class="method-heading attribute-method-heading">
|
168
|
-
<span class="method-name">excluded_words</span><span
|
169
|
-
class="attribute-access-type">[RW]</span>
|
170
|
-
</div>
|
171
|
-
|
172
|
-
<div class="method-description">
|
173
|
-
|
174
|
-
<p>The words that are to be excluded.</p>
|
175
|
-
|
176
|
-
<p>@param [Array] words</p>
|
177
|
-
|
178
|
-
<p>@return [Array]</p>
|
179
|
-
|
180
|
-
</div>
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div id="attribute-i-lazy" class="method-detail">
|
184
|
-
<div class="method-heading attribute-method-heading">
|
185
|
-
<span class="method-name">lazy</span><span
|
186
|
-
class="attribute-access-type">[W]</span>
|
187
|
-
</div>
|
188
|
-
|
189
|
-
<div class="method-description">
|
190
|
-
|
191
|
-
<p>This boolean determines if flipping should be performed lazily.</p>
|
192
|
-
|
193
|
-
<p>@param [Boolean] true if should be lazy.</p>
|
194
|
-
|
195
|
-
<p>@return [Boolean]</p>
|
196
|
-
|
197
|
-
</div>
|
198
|
-
</div>
|
199
|
-
|
200
|
-
<div id="attribute-i-logfile_name" class="method-detail">
|
201
|
-
<div class="method-heading attribute-method-heading">
|
202
|
-
<span class="method-name">logfile_name</span><span
|
203
|
-
class="attribute-access-type">[RW]</span>
|
204
|
-
</div>
|
205
|
-
|
206
|
-
<div class="method-description">
|
207
|
-
|
208
|
-
<p>The full path to the log file.</p>
|
209
|
-
|
210
|
-
<p>@param [String] file</p>
|
211
|
-
|
212
|
-
<p>@return [String]</p>
|
213
|
-
|
214
|
-
</div>
|
215
|
-
</div>
|
216
|
-
|
217
|
-
<div id="attribute-i-reverse" class="method-detail">
|
218
|
-
<div class="method-heading attribute-method-heading">
|
219
|
-
<span class="method-name">reverse</span><span
|
220
|
-
class="attribute-access-type">[W]</span>
|
221
|
-
</div>
|
222
|
-
|
223
|
-
<div class="method-description">
|
224
|
-
|
225
|
-
<p>This boolean determines if flipping should be reversed.</p>
|
226
|
-
|
227
|
-
<p>@param [Boolean] true if should be reversed.</p>
|
228
|
-
|
229
|
-
<p>@return [Boolean]</p>
|
230
|
-
|
231
|
-
</div>
|
232
|
-
</div>
|
233
|
-
|
234
|
-
<div id="attribute-i-words" class="method-detail">
|
235
|
-
<div class="method-heading attribute-method-heading">
|
236
|
-
<span class="method-name">words</span><span
|
237
|
-
class="attribute-access-type">[R]</span>
|
238
|
-
</div>
|
239
|
-
|
240
|
-
<div class="method-description">
|
241
|
-
|
242
|
-
<p>The words originally passed at initialization.</p>
|
243
|
-
|
244
|
-
<p>@return [Array]</p>
|
245
|
-
|
246
|
-
</div>
|
247
|
-
</div>
|
248
|
-
|
249
|
-
</section>
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
254
|
-
<header>
|
255
|
-
<h3>Public Class Methods</h3>
|
256
|
-
</header>
|
257
|
-
|
258
|
-
|
259
|
-
<div id="method-c-new" class="method-detail ">
|
260
|
-
|
261
|
-
<div class="method-heading">
|
262
|
-
<span class="method-name">new</span><span
|
263
|
-
class="method-args">(words, config_file = nil) { |self| ... }</span>
|
264
|
-
|
265
|
-
<span class="method-click-advice">click to toggle source</span>
|
266
|
-
|
267
|
-
</div>
|
268
|
-
|
269
|
-
|
270
|
-
<div class="method-description">
|
271
|
-
|
272
|
-
<p>Initialize instance. You can also use the <code>config_file</code> either by passing it at initialization, or via the setter. The config file will be automatically loaded if passed at initialization, before the instance is yielded so you can still change the values via the block. If set via the setter, you must call `#load_config_file`.</p>
|
273
|
-
|
274
|
-
<p>@param [Array] words</p>
|
275
|
-
|
276
|
-
<p>@param [String] <a href="Spoonerism.html#attribute-i-config_file"><code>config_file</code></a></p>
|
277
|
-
|
278
|
-
<p>@example</p>
|
279
|
-
|
280
|
-
<pre class="ruby"><span class="ruby-comment"># Config file would be automatically loaded before block is executed.</span>
|
281
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-constant">Spoonerise</span><span class="ruby-operator">::</span><span class="ruby-constant">Spoonerism</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">%w[not too shabby]</span>, <span class="ruby-string">'~/.spoonerize.yml'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sp</span><span class="ruby-operator">|</span>
|
282
|
-
<span class="ruby-identifier">sp</span>.<span class="ruby-identifier">reverse</span> = <span class="ruby-keyword">true</span> <span class="ruby-comment"># Would override setting from config file</span>
|
283
|
-
<span class="ruby-keyword">end</span>
|
284
|
-
<span class="ruby-comment"># Config file would need to be manually loaded.</span>
|
285
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-constant">Spoonerise</span><span class="ruby-operator">::</span><span class="ruby-constant">Spoonerism</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">%w[not too shabby]</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sp</span><span class="ruby-operator">|</span>
|
286
|
-
<span class="ruby-identifier">sp</span>.<span class="ruby-identifier">config_file</span> = <span class="ruby-string">'~/.spoonerize.yml'</span>
|
287
|
-
<span class="ruby-identifier">sp</span>.<span class="ruby-identifier">reverse</span> = <span class="ruby-keyword">true</span>
|
288
|
-
<span class="ruby-keyword">end</span>
|
289
|
-
<span class="ruby-identifier">s</span>.<span class="ruby-identifier">load_config_file</span> <span class="ruby-comment"># Would override setting from initialization</span>
|
290
|
-
</pre>
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
<div class="method-source-code" id="new-source">
|
296
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 80</span>
|
297
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">words</span>, <span class="ruby-identifier">config_file</span> = <span class="ruby-keyword">nil</span>)
|
298
|
-
<span class="ruby-ivar">@config</span> = {}
|
299
|
-
<span class="ruby-ivar">@excluded_words</span> = []
|
300
|
-
<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>)
|
301
|
-
<span class="ruby-ivar">@lazy</span> = <span class="ruby-keyword">false</span>
|
302
|
-
<span class="ruby-ivar">@reverse</span> = <span class="ruby-keyword">false</span>
|
303
|
-
<span class="ruby-ivar">@config_file</span> = <span class="ruby-identifier">config_file</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">config_file</span>)
|
304
|
-
<span class="ruby-ivar">@config_file_loaded</span> = <span class="ruby-keyword">false</span>
|
305
|
-
<span class="ruby-ivar">@logfile_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(
|
306
|
-
<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>)
|
307
|
-
)
|
308
|
-
|
309
|
-
<span class="ruby-identifier">load_config_file</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">config_file</span>
|
310
|
-
|
311
|
-
<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>
|
312
|
-
<span class="ruby-keyword">end</span></pre>
|
313
|
-
</div>
|
314
|
-
|
315
|
-
</div>
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
</div>
|
321
|
-
|
322
|
-
|
323
|
-
</section>
|
324
|
-
|
325
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
326
|
-
<header>
|
327
|
-
<h3>Public Instance Methods</h3>
|
328
|
-
</header>
|
329
|
-
|
330
|
-
|
331
|
-
<div id="method-i-all_excluded_words" class="method-detail ">
|
332
|
-
|
333
|
-
<div class="method-heading">
|
334
|
-
<span class="method-name">all_excluded_words</span><span
|
335
|
-
class="method-args">()</span>
|
336
|
-
|
337
|
-
<span class="method-click-advice">click to toggle source</span>
|
338
|
-
|
339
|
-
</div>
|
340
|
-
|
341
|
-
|
342
|
-
<div class="method-description">
|
343
|
-
|
344
|
-
<p>Returns an array of words to exclude by combining three arrays:</p>
|
345
|
-
<ul><li>
|
346
|
-
<p>Any word in the passed arguments that's only one character</p>
|
347
|
-
</li><li>
|
348
|
-
<p>Any user-passed words, stored in <code>excluded_words</code></p>
|
349
|
-
</li><li>
|
350
|
-
<p>If lazy-mode, the LAZY_WORDS from yaml file are added</p>
|
351
|
-
</li></ul>
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
<div class="method-source-code" id="all_excluded_words-source">
|
357
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 160</span>
|
358
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">all_excluded_words</span>
|
359
|
-
(<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>)
|
360
|
-
<span class="ruby-keyword">end</span></pre>
|
361
|
-
</div>
|
362
|
-
|
363
|
-
</div>
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
</div>
|
369
|
-
|
370
|
-
|
371
|
-
<div id="method-i-config_file-3D" class="method-detail ">
|
372
|
-
|
373
|
-
<div class="method-heading">
|
374
|
-
<span class="method-name">config_file=</span><span
|
375
|
-
class="method-args">(config_file)</span>
|
376
|
-
|
377
|
-
<span class="method-click-advice">click to toggle source</span>
|
378
|
-
|
379
|
-
</div>
|
380
|
-
|
381
|
-
|
382
|
-
<div class="method-description">
|
383
|
-
|
384
|
-
<p>Setter for <code>config_file</code>. Must be expanded in case the user uses `~` for home.</p>
|
385
|
-
|
386
|
-
<p>@param [String] file</p>
|
387
|
-
|
388
|
-
<p>@return [String]</p>
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
<div class="method-source-code" id="config_file-3D-source">
|
394
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 171</span>
|
395
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">config_file=</span>(<span class="ruby-identifier">config_file</span>)
|
396
|
-
<span class="ruby-ivar">@config_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">config_file</span>)
|
397
|
-
<span class="ruby-keyword">end</span></pre>
|
398
|
-
</div>
|
399
|
-
|
400
|
-
</div>
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
</div>
|
406
|
-
|
407
|
-
|
408
|
-
<div id="method-i-config_file_loaded-3F" class="method-detail ">
|
409
|
-
|
410
|
-
<div class="method-heading">
|
411
|
-
<span class="method-name">config_file_loaded?</span><span
|
412
|
-
class="method-args">()</span>
|
413
|
-
|
414
|
-
<span class="method-click-advice">click to toggle source</span>
|
415
|
-
|
416
|
-
</div>
|
417
|
-
|
418
|
-
|
419
|
-
<div class="method-description">
|
420
|
-
|
421
|
-
<p>Has a config file been loaded?</p>
|
422
|
-
|
423
|
-
<p>@return [Boolean]</p>
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
<div class="method-source-code" id="config_file_loaded-3F-source">
|
429
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 127</span>
|
430
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">config_file_loaded?</span>
|
431
|
-
<span class="ruby-ivar">@config_file_loaded</span>
|
432
|
-
<span class="ruby-keyword">end</span></pre>
|
433
|
-
</div>
|
434
|
-
|
435
|
-
</div>
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
</div>
|
441
|
-
|
442
|
-
|
443
|
-
<div id="method-i-enough_flippable_words-3F" class="method-detail ">
|
444
|
-
|
445
|
-
<div class="method-heading">
|
446
|
-
<span class="method-name">enough_flippable_words?</span><span
|
447
|
-
class="method-args">()</span>
|
448
|
-
|
449
|
-
<span class="method-click-advice">click to toggle source</span>
|
450
|
-
|
451
|
-
</div>
|
452
|
-
|
453
|
-
|
454
|
-
<div class="method-description">
|
455
|
-
|
456
|
-
<p>Returns true if there are more than one non-excluded word to flip</p>
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
<div class="method-source-code" id="enough_flippable_words-3F-source">
|
462
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 133</span>
|
463
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">enough_flippable_words?</span>
|
464
|
-
(<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>
|
465
|
-
<span class="ruby-keyword">end</span></pre>
|
466
|
-
</div>
|
467
|
-
|
468
|
-
</div>
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
</div>
|
474
|
-
|
475
|
-
|
476
|
-
<div id="method-i-lazy-3F" class="method-detail ">
|
477
|
-
|
478
|
-
<div class="method-heading">
|
479
|
-
<span class="method-name">lazy?</span><span
|
480
|
-
class="method-args">()</span>
|
481
|
-
|
482
|
-
<span class="method-click-advice">click to toggle source</span>
|
483
|
-
|
484
|
-
</div>
|
485
|
-
|
486
|
-
|
487
|
-
<div class="method-description">
|
488
|
-
|
489
|
-
<p>Should the lazy words be excluded?</p>
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
<div class="method-source-code" id="lazy-3F-source">
|
495
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 139</span>
|
496
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">lazy?</span>
|
497
|
-
<span class="ruby-ivar">@lazy</span>
|
498
|
-
<span class="ruby-keyword">end</span></pre>
|
499
|
-
</div>
|
500
|
-
|
501
|
-
</div>
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
</div>
|
507
|
-
|
508
|
-
|
509
|
-
<div id="method-i-load_config_file" class="method-detail ">
|
510
|
-
|
511
|
-
<div class="method-heading">
|
512
|
-
<span class="method-name">load_config_file</span><span
|
513
|
-
class="method-args">()</span>
|
514
|
-
|
515
|
-
<span class="method-click-advice">click to toggle source</span>
|
516
|
-
|
517
|
-
</div>
|
518
|
-
|
519
|
-
|
520
|
-
<div class="method-description">
|
521
|
-
|
522
|
-
<p>Loads the config file</p>
|
523
|
-
|
524
|
-
<p>@return [Hash] The config options</p>
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
<div class="method-source-code" id="load_config_file-source">
|
530
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 179</span>
|
531
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">load_config_file</span>
|
532
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-string">'No config file set'</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">config_file</span>.<span class="ruby-identifier">nil?</span>
|
533
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-node">"File #{config_file} does not exist"</span> <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">config_file</span>)
|
534
|
-
<span class="ruby-ivar">@config</span> = <span class="ruby-constant">YAML</span><span class="ruby-operator">::</span><span class="ruby-identifier">load_file</span>(<span class="ruby-identifier">config_file</span>)
|
535
|
-
<span class="ruby-ivar">@config_file_loaded</span> = <span class="ruby-keyword">true</span>
|
536
|
-
<span class="ruby-ivar">@config</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">send</span>(<span class="ruby-node">"#{k}="</span>, <span class="ruby-identifier">v</span>) }
|
537
|
-
<span class="ruby-keyword">end</span></pre>
|
538
|
-
</div>
|
539
|
-
|
540
|
-
</div>
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
</div>
|
546
|
-
|
547
|
-
|
548
|
-
<div id="method-i-reverse-3F" class="method-detail ">
|
549
|
-
|
550
|
-
<div class="method-heading">
|
551
|
-
<span class="method-name">reverse?</span><span
|
552
|
-
class="method-args">()</span>
|
553
|
-
|
554
|
-
<span class="method-click-advice">click to toggle source</span>
|
555
|
-
|
556
|
-
</div>
|
557
|
-
|
558
|
-
|
559
|
-
<div class="method-description">
|
560
|
-
|
561
|
-
<p>Should the words flip the other direction?</p>
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
<div class="method-source-code" id="reverse-3F-source">
|
567
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 145</span>
|
568
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">reverse?</span>
|
569
|
-
<span class="ruby-ivar">@reverse</span>
|
570
|
-
<span class="ruby-keyword">end</span></pre>
|
571
|
-
</div>
|
572
|
-
|
573
|
-
</div>
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
</div>
|
579
|
-
|
580
|
-
|
581
|
-
<div id="method-i-save" class="method-detail ">
|
582
|
-
|
583
|
-
<div class="method-heading">
|
584
|
-
<span class="method-name">save</span><span
|
585
|
-
class="method-args">()</span>
|
586
|
-
|
587
|
-
<span class="method-click-advice">click to toggle source</span>
|
588
|
-
|
589
|
-
</div>
|
590
|
-
|
591
|
-
|
592
|
-
<div class="method-description">
|
593
|
-
|
594
|
-
<p>Saves the flipped words to the log file, along with the options</p>
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
<div class="method-source-code" id="save-source">
|
600
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 151</span>
|
601
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">save</span>
|
602
|
-
<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>)])
|
603
|
-
<span class="ruby-keyword">end</span></pre>
|
604
|
-
</div>
|
605
|
-
|
606
|
-
</div>
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
</div>
|
612
|
-
|
613
|
-
|
614
|
-
<div id="method-i-spoonerize" class="method-detail ">
|
615
|
-
|
616
|
-
<div class="method-heading">
|
617
|
-
<span class="method-name">spoonerize</span><span
|
618
|
-
class="method-args">()</span>
|
619
|
-
|
620
|
-
<span class="method-click-advice">click to toggle source</span>
|
621
|
-
|
622
|
-
</div>
|
623
|
-
|
624
|
-
|
625
|
-
<div class="method-description">
|
626
|
-
|
627
|
-
<p>Iterates through words array, and maps its elements to the output of flip_words. Returns results as an array.</p>
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
<div class="method-source-code" id="spoonerize-source">
|
633
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 100</span>
|
634
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">spoonerize</span>
|
635
|
-
<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>
|
636
|
-
<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>) }
|
637
|
-
<span class="ruby-keyword">end</span></pre>
|
638
|
-
</div>
|
639
|
-
|
640
|
-
</div>
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
</div>
|
646
|
-
|
647
|
-
|
648
|
-
<div id="method-i-to_h" class="method-detail ">
|
649
|
-
|
650
|
-
<div class="method-heading">
|
651
|
-
<span class="method-name">to_h</span><span
|
652
|
-
class="method-args">()</span>
|
653
|
-
|
654
|
-
<span class="method-click-advice">click to toggle source</span>
|
655
|
-
|
656
|
-
</div>
|
657
|
-
|
658
|
-
|
659
|
-
<div class="method-description">
|
660
|
-
|
661
|
-
<p>Returns hash of the original words mapped to their flipped counterparts.</p>
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
<div class="method-source-code" id="to_h-source">
|
667
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 113</span>
|
668
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_h</span>
|
669
|
-
<span class="ruby-constant">Hash</span>[<span class="ruby-identifier">words</span>.<span class="ruby-identifier">zip</span>(<span class="ruby-identifier">spoonerize</span>)]
|
670
|
-
<span class="ruby-keyword">end</span></pre>
|
671
|
-
</div>
|
672
|
-
|
673
|
-
</div>
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
</div>
|
679
|
-
|
680
|
-
|
681
|
-
<div id="method-i-to_json" class="method-detail ">
|
682
|
-
|
683
|
-
<div class="method-heading">
|
684
|
-
<span class="method-name">to_json</span><span
|
685
|
-
class="method-args">()</span>
|
686
|
-
|
687
|
-
<span class="method-click-advice">click to toggle source</span>
|
688
|
-
|
689
|
-
</div>
|
690
|
-
|
691
|
-
|
692
|
-
<div class="method-description">
|
693
|
-
|
694
|
-
<p>Same as <a href="Spoonerism.html#method-i-to_h"><code>to_h</code></a>, but as json.</p>
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
<div class="method-source-code" id="to_json-source">
|
700
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 119</span>
|
701
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_json</span>
|
702
|
-
<span class="ruby-identifier">to_h</span>.<span class="ruby-identifier">to_json</span>
|
703
|
-
<span class="ruby-keyword">end</span></pre>
|
704
|
-
</div>
|
705
|
-
|
706
|
-
</div>
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
</div>
|
712
|
-
|
713
|
-
|
714
|
-
<div id="method-i-to_s" class="method-detail ">
|
715
|
-
|
716
|
-
<div class="method-heading">
|
717
|
-
<span class="method-name">to_s</span><span
|
718
|
-
class="method-args">()</span>
|
719
|
-
|
720
|
-
<span class="method-click-advice">click to toggle source</span>
|
721
|
-
|
722
|
-
</div>
|
723
|
-
|
724
|
-
|
725
|
-
<div class="method-description">
|
726
|
-
|
727
|
-
<p>Returns spoonerize array as a joined string.</p>
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
<div class="method-source-code" id="to_s-source">
|
733
|
-
<pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 107</span>
|
734
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
|
735
|
-
<span class="ruby-identifier">spoonerize</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">' '</span>)
|
736
|
-
<span class="ruby-keyword">end</span></pre>
|
737
|
-
</div>
|
738
|
-
|
739
|
-
</div>
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
</div>
|
745
|
-
|
746
|
-
|
747
|
-
</section>
|
748
|
-
|
749
|
-
</section>
|
750
|
-
|
751
|
-
</main>
|
752
|
-
|
753
|
-
|
754
|
-
<footer id="validator-badges" role="contentinfo">
|
755
|
-
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
756
|
-
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
|
757
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
758
|
-
</footer>
|
759
|
-
|