spoonerize 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c887f63e01d902734fb320a70c601f47b106df4a0aa7d947c81bd0526551888a
4
- data.tar.gz: 655efdb264c515d783593ac758108aeb7cd007bfa57eb330116821879aaa0900
3
+ metadata.gz: 9b87634fd09d0a168098bb2c91ee8ffd978e2d1bfd6fe1783ebce28e64617fbb
4
+ data.tar.gz: b852745fc0fe8a2ecbb95181275de0642d2975380f79b29f6cac3252116d9901
5
5
  SHA512:
6
- metadata.gz: b845888c7a817fcf82a0bda6b8b30511360fb8eb3418fb54ced28cda89945dcf86554352b79c40d9bec457625dcc09341e84080f56da3bb57bd0b71d54591abc
7
- data.tar.gz: 4ff21e42bc4b4a9f0ec6acde250e1337ed1029ab9f6beb844b1c7d98d65d3f1b126e6901f5472125e76bf5e71bf943c6a51a698c0cfd2e9ca0309ac3938358e9
6
+ metadata.gz: c2f178fbed34dceed86b76bdc1c97d6d5f0aa23daeb73b6d5cc233a9a9c2292bd4fd83bb671a1a0e009d28fda6a71b221378d161927852b43b9f47b985b847ee
7
+ data.tar.gz: e92bfa5bd30bdeee7515bda37cd58a112552ece8709d515468b5c3f2497527f15ac87eaa9c71f3f09eeb71dff4b7b0572749d6faf75e086d32b548017292061c
data/.gitignore CHANGED
@@ -1 +1 @@
1
- spoonerise-*.gem
1
+ spoonerize-*.gem
data/README.md CHANGED
@@ -1,22 +1,50 @@
1
- # Welcome to [Spoonerize](https://evanthegrayt.github.io/spoonerize) -- a word game
2
- > Sponerism *[noun]* a verbal error in which a speaker accidentally transposes
1
+ # Welcome to Spoonerize -- a word game.
2
+ [![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fevanthegrayt%2Fspoonerize%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/evanthegrayt/spoonerize/goto?ref=master)
3
+ [![Gem Version](https://badge.fury.io/rb/spoonerize.svg)](https://badge.fury.io/rb/spoonerize)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ > Spoonerism *[noun]* a verbal error in which a speaker accidentally transposes
3
7
  > the initial sounds or letters of two or more words, often to humorous effect.
4
8
 
5
- We've all done it; someone says a phrase, and you flip the first few letters
6
- around, and sometimes, it makes an even funnier phrase. For example:
7
- "Tomb Raider" becomes "Romb Taider".
8
- Well, when I was in high school, we took it further -- probably too far -- and
9
- made a rule set. This program follows those rules, which are listed below.
9
+ View on [Github](https://github.com/evanthegrayt/spoonerize) |
10
+ [Github Pages](https://evanthegrayt.github.io/spoonerize/) |
11
+ [RubyGems](https://rubygems.org/gems/spoonerize)
10
12
 
11
13
  ## Table of Contents
14
+ - [About](#about)
12
15
  - [Installation](#installation)
13
16
  - [Automated](#automated)
14
17
  - [Manual](#manual)
15
18
  - [Command Line Usage](#command-line-usage)
19
+ - [Config file](#config-file)
16
20
  - [API](#api)
17
- - [Rules of the Game](#rules-of-the-game)
21
+ - [Documentation](https://evanthegrayt.github.io/spoonerize/doc/index.html)
18
22
  - [Self-Promotion](#self-promotion)
19
23
 
24
+ ## About
25
+ We've all done it; someone says a phrase, and you flip the first few letters
26
+ around, and sometimes, it makes an even funnier phrase. For example:
27
+ "Tomb Raider" becomes "Romb Taider".
28
+ Well, when I was in high school, we took it further -- probably too far -- and
29
+ made a rule set. This gem, which includes a command-line executable, follows
30
+ those rules, which are:
31
+
32
+ - Each word drops its leading consonant group and takes the leading consonant
33
+ group of the next word.
34
+ - If the word has no leading consonants, nothing is dropped, but it still
35
+ receives the next word's leading consonants if it has any.
36
+ - If the next word has no leading consonants, the current word receives no
37
+ consonants, but will still lose its own if it has any.
38
+ - When being "lazy", common words ("the", "his", etc.) remain unchanged.
39
+ - If the word to pull from is excluded, that word is skipped, and you pull the
40
+ leading consonants from the next non-excluded word.
41
+ - "Q" and "U" should stay together (like "queen").
42
+ - A lot of the time, the words won't look how they're supposed to sound, as you
43
+ go by how the word *used* to sound, not how it's spelled. For instance,
44
+ `$ spoonerize two new cuties` becomes "no cew twuties", but it would be
45
+ pronounced "new coo tooties", as the words retain their original sounds.
46
+
47
+
20
48
  ## Installation
21
49
  ### Automated
22
50
  Just install the gem!
@@ -67,37 +95,84 @@ get the results. For example:
67
95
 
68
96
  ```
69
97
  $ spoonerize -s not too shabby
70
- Saving [tot shoo nabby] to /Users/evan.gray/workflow/spoonerize/log/spoonerize.csv
98
+ Saving [tot shoo nabby] to ~/.cache/spoonerize/spoonerize.csv
71
99
 
72
100
  $ spoonerize -rs not too shabby
73
- Saving [shot noo tabby] to /Users/evan.gray/workflow/spoonerize/log/spoonerize.csv
101
+ Saving [shot noo tabby] to ~/.cache/spoonerize/spoonerize.csv
74
102
 
75
103
  $ spoonerize -p
76
104
  not too shabby | tot shoo nabby | No Options
77
105
  not too shabby | shot noo tabby | Reverse
78
106
  ```
79
107
 
80
- To get a list of all available options, run with `-h`.
108
+ Here is a list of all available options:
109
+
110
+ ```
111
+ -r, --[no-]reverse Reverse flipping
112
+ -l, --[no-]lazy Skip small words
113
+ -m, --[no-]map Print words mapping
114
+ -p, --[no-]print Print all entries in the log
115
+ -s, --[no-]save Save results in log
116
+ --exclude=WORDS Words to skip
117
+ ```
118
+
119
+ ### Config File
120
+ You can create a config file called `~/.spoonerize.yml`. In this file, you can
121
+ change default options at runtime. Available settings are:
122
+
123
+ ```yaml
124
+ # Setting Default
125
+ excluded_words: []
126
+ lazy: false
127
+ reverse: false
128
+ logfile_name: '~/.cache/spoonerize/spoonerize.csv'
129
+ ```
130
+
131
+ Options set by this file can be overridden at runtime by the use of the
132
+ executable's flags.
81
133
 
82
134
  ## API
83
- This readme isn't finished, but you can view [API
84
- documentation](https://evanthegrayt.github.io/spoonerize/doc/index.html).
135
+ The API is [fully
136
+ documented](https://evanthegrayt.github.io/spoonerize/doc/index.html), but below
137
+ are some quick examples of how you could use this in your ruby code.
85
138
 
86
- ## Rules of the Game
87
- - Each word drops its leading consonant group and takes the leading consonant
88
- group of the next word.
89
- - If the word has no leading consonants, nothing is dropped, but it still
90
- receives the next word's leading consonants if it has any.
91
- - If the next word has no leading consonants, the current word receives no
92
- consonants, but will still lose its own if it has any.
93
- - When being "lazy", common words ("the", "his", etc.) remain unchanged.
94
- - If the word to pull from is excluded, that word is skipped, and you pull the
95
- leading consonants from the next non-excluded word.
96
- - "Q" and "U" should stay together (like "queen").
97
- - A lot of the time, the words won't look how they're supposed to sound, as you
98
- go by how the word *used* to sound, not how it's spelled. For instance,
99
- `$ spoonerize two new cuties` becomes "no cew twuties", but it would be
100
- pronounced "new coo tooties", as the words retain their original sounds.
139
+ ```ruby
140
+ require 'spoonerize'
141
+
142
+ spoonerism = Spoonerize::Spoonerism.new(%w[not too shabby]) do |s|
143
+ s.reverse = true
144
+ end
145
+
146
+ spoonerism.spoonerize
147
+ # => shot noo tabby
148
+
149
+ spoonerism.reverse = false
150
+ spoonerism.spoonerize
151
+ # => tot shoo nabby
152
+
153
+ spoonerism.logfile_name = '~/.cache/spoonerize/spoonerize.csv'
154
+ spoonerism.save
155
+ ```
156
+
157
+ You can also use the [config file](#config-file), either by passing it at
158
+ initialization, or via the setter. The config file will be automatically loaded
159
+ if passed at initialization, before the instance is yielded so you can still
160
+ change the values via the block. If set via the setter, you must call
161
+ `#load_config_file`.
162
+
163
+ ```ruby
164
+ # Config file would be automatically loaded before block is executed.
165
+ s = Spoonerise::Spoonerism.new(%w[not too shabby], '~/.spoonerize.yml') do |sp|
166
+ sp.reverse = true
167
+ end
168
+
169
+ # Config file would need to be manually loaded.
170
+ s = Spoonerise::Spoonerism.new(%w[not too shabby]) do |sp|
171
+ sp.config_file = '~/.spoonerize.yml'
172
+ end
173
+
174
+ s.load_config_file
175
+ ```
101
176
 
102
177
  ## Self Promotion
103
178
  I do these projects for fun, and I enjoy knowing that they're helpful to people.
@@ -60,14 +60,15 @@
60
60
  <h3>Table of Contents</h3>
61
61
 
62
62
  <ul class="link-list" role="directory">
63
- <li><a href="#label-Welcome+to+Spoonerize+--+a+word+game">Welcome to <a href="https://evanthegrayt.github.io/spoonerize">Spoonerize</a> – a word game</a>
63
+ <li><a href="#label-Welcome+to+Spoonerize+--+a+word+game.">Welcome to Spoonerize – a word game.</a>
64
64
  <li><a href="#label-Table+of+Contents">Table of Contents</a>
65
+ <li><a href="#label-About">About</a>
65
66
  <li><a href="#label-Installation">Installation</a>
66
67
  <li><a href="#label-Automated">Automated</a>
67
68
  <li><a href="#label-Manual">Manual</a>
68
69
  <li><a href="#label-Command+Line+Usage">Command Line Usage</a>
70
+ <li><a href="#label-Config+File">Config File</a>
69
71
  <li><a href="#label-API">API</a>
70
- <li><a href="#label-Rules+of+the+Game">Rules of the Game</a>
71
72
  <li><a href="#label-Self+Promotion">Self Promotion</a>
72
73
  </ul>
73
74
  </div>
@@ -89,16 +90,20 @@
89
90
 
90
91
  <main role="main" aria-label="Page README.md">
91
92
 
92
- <h1 id="label-Welcome+to+Spoonerize+--+a+word+game">Welcome to <a href="https://evanthegrayt.github.io/spoonerize">Spoonerize</a> – a word game<span><a href="#label-Welcome+to+Spoonerize+--+a+word+game">&para;</a> <a href="#top">&uarr;</a></span></h1>
93
+ <h1 id="label-Welcome+to+Spoonerize+--+a+word+game.">Welcome to <a href="Spoonerize.html"><code>Spoonerize</code></a> – a word game.<span><a href="#label-Welcome+to+Spoonerize+--+a+word+game.">&para;</a> <a href="#top">&uarr;</a></span></h1>
94
+
95
+ <p><a href="https://actions-badge.atrox.dev/evanthegrayt/spoonerize/goto?ref=master"><img src="https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fevanthegrayt%2Fspoonerize%2Fbadge%3Fref%3Dmaster&style=flat"></a> <a href="https://badge.fury.io/rb/spoonerize"><img src="https://badge.fury.io/rb/spoonerize.svg"></a> <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg"></a></p>
93
96
 
94
97
  <blockquote>
95
- <p>Sponerism <em>noun</em> a verbal error in which a speaker accidentally transposes the initial sounds or letters of two or more words, often to humorous effect.</p>
98
+ <p>Spoonerism <em>[noun]</em> a verbal error in which a speaker accidentally transposes the initial sounds or letters of two or more words, often to humorous effect.</p>
96
99
  </blockquote>
97
100
 
98
- <p>We&#39;ve all done it; someone says a phrase, and you flip the first few letters around, and sometimes, it makes an even funnier phrase. For example: “Tomb Raider” becomes “Romb Taider”. Well, when I was in high school, we took it further – probably too far – and made a rule set. This program follows those rules, which are listed below.</p>
101
+ <p>View on <a href="https://github.com/evanthegrayt/spoonerize">Github</a> | <a href="https://evanthegrayt.github.io/spoonerize/">Github Pages</a> | <a href="https://rubygems.org/gems/spoonerize">RubyGems</a></p>
99
102
 
100
103
  <h2 id="label-Table+of+Contents">Table of Contents<span><a href="#label-Table+of+Contents">&para;</a> <a href="#top">&uarr;</a></span></h2>
101
104
  <ul><li>
105
+ <p><a href="#about">About</a></p>
106
+ </li><li>
102
107
  <p><a href="#installation">Installation</a></p>
103
108
  </li><li>
104
109
  <p><a href="#automated">Automated</a></p>
@@ -107,13 +112,34 @@
107
112
  </li><li>
108
113
  <p><a href="#command-line-usage">Command Line Usage</a></p>
109
114
  </li><li>
115
+ <p><a href="#config-file">Config file</a></p>
116
+ </li><li>
110
117
  <p><a href="#api">API</a></p>
111
118
  </li><li>
112
- <p><a href="#rules-of-the-game">Rules of the Game</a></p>
119
+ <p><a href="https://evanthegrayt.github.io/spoonerize/doc/index.html">Documentation</a></p>
113
120
  </li><li>
114
121
  <p><a href="#self-promotion">Self-Promotion</a></p>
115
122
  </li></ul>
116
123
 
124
+ <h2 id="label-About">About<span><a href="#label-About">&para;</a> <a href="#top">&uarr;</a></span></h2>
125
+
126
+ <p>We&#39;ve all done it; someone says a phrase, and you flip the first few letters around, and sometimes, it makes an even funnier phrase. For example: “Tomb Raider” becomes “Romb Taider”. Well, when I was in high school, we took it further – probably too far – and made a rule set. This gem, which includes a command-line executable, follows those rules, which are:</p>
127
+ <ul><li>
128
+ <p>Each word drops its leading consonant group and takes the leading consonant group of the next word.</p>
129
+ </li><li>
130
+ <p>If the word has no leading consonants, nothing is dropped, but it still receives the next word&#39;s leading consonants if it has any.</p>
131
+ </li><li>
132
+ <p>If the next word has no leading consonants, the current word receives no consonants, but will still lose its own if it has any.</p>
133
+ </li><li>
134
+ <p>When being “lazy”, common words (“the”, “his”, etc.) remain unchanged.</p>
135
+ </li><li>
136
+ <p>If the word to pull from is excluded, that word is skipped, and you pull the leading consonants from the next non-excluded word.</p>
137
+ </li><li>
138
+ <p>“Q” and “U” should stay together (like “queen”).</p>
139
+ </li><li>
140
+ <p>A lot of the time, the words won&#39;t look how they&#39;re supposed to sound, as you go by how the word <em>used</em> to sound, not how it&#39;s spelled. For instance, <code>$ spoonerize two new cuties</code> becomes “no cew twuties”, but it would be pronounced “new coo tooties”, as the words retain their original sounds.</p>
141
+ </li></ul>
142
+
117
143
  <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
118
144
 
119
145
  <h3 id="label-Automated">Automated<span><a href="#label-Automated">&para;</a> <a href="#top">&uarr;</a></span></h3>
@@ -152,37 +178,71 @@ ln -s $PWD/bin/spoonerize /usr/local/bin/spoonerize
152
178
  <p>If you find a phrase funny enough to save, you can pass the <code>-s</code> flag. This will write the results to the logfile. You can print your log file with the <code>-p</code> flag. It will show the original phrase, the end result, and the options used to get the results. For example:</p>
153
179
 
154
180
  <pre>$ spoonerize -s not too shabby
155
- Saving [tot shoo nabby] to /Users/evan.gray/workflow/spoonerize/log/spoonerize.csv
181
+ Saving [tot shoo nabby] to ~/.cache/spoonerize/spoonerize.csv
156
182
 
157
183
  $ spoonerize -rs not too shabby
158
- Saving [shot noo tabby] to /Users/evan.gray/workflow/spoonerize/log/spoonerize.csv
184
+ Saving [shot noo tabby] to ~/.cache/spoonerize/spoonerize.csv
159
185
 
160
186
  $ spoonerize -p
161
187
  not too shabby | tot shoo nabby | No Options
162
188
  not too shabby | shot noo tabby | Reverse</pre>
163
189
 
164
- <p>To get a list of all available options, run with <code>-h</code>.</p>
190
+ <p>Here is a list of all available options:</p>
191
+
192
+ <pre>-r, --[no-]reverse Reverse flipping
193
+ -l, --[no-]lazy Skip small words
194
+ -m, --[no-]map Print words mapping
195
+ -p, --[no-]print Print all entries in the log
196
+ -s, --[no-]save Save results in log
197
+ --exclude=WORDS Words to skip</pre>
198
+
199
+ <h3 id="label-Config+File">Config File<span><a href="#label-Config+File">&para;</a> <a href="#top">&uarr;</a></span></h3>
200
+
201
+ <p>You can create a config file called <code>~/.spoonerize.yml</code>. In this file, you can change default options at runtime. Available settings are:</p>
202
+
203
+ <pre># Setting Default
204
+ excluded_words: []
205
+ lazy: false
206
+ reverse: false
207
+ logfile_name: &#39;~/.cache/spoonerize/spoonerize.csv&#39;</pre>
208
+
209
+ <p>Options set by this file can be overridden at runtime by the use of the executable&#39;s flags.</p>
165
210
 
166
211
  <h2 id="label-API">API<span><a href="#label-API">&para;</a> <a href="#top">&uarr;</a></span></h2>
167
212
 
168
- <p>This readme isn&#39;t finished, but you can view <a href="https://evanthegrayt.github.io/spoonerize/doc/index.html">API documentation</a>.</p>
213
+ <p>The API is <a href="https://evanthegrayt.github.io/spoonerize/doc/index.html">fully documented</a>, but below are some quick examples of how you could use this in your ruby code.</p>
169
214
 
170
- <h2 id="label-Rules+of+the+Game">Rules of the Game<span><a href="#label-Rules+of+the+Game">&para;</a> <a href="#top">&uarr;</a></span></h2>
171
- <ul><li>
172
- <p>Each word drops its leading consonant group and takes the leading consonant group of the next word.</p>
173
- </li><li>
174
- <p>If the word has no leading consonants, nothing is dropped, but it still receives the next word&#39;s leading consonants if it has any.</p>
175
- </li><li>
176
- <p>If the next word has no leading consonants, the current word receives no consonants, but will still lose its own if it has any.</p>
177
- </li><li>
178
- <p>When being “lazy”, common words (“the”, “his”, etc.) remain unchanged.</p>
179
- </li><li>
180
- <p>If the word to pull from is excluded, that word is skipped, and you pull the leading consonants from the next non-excluded word.</p>
181
- </li><li>
182
- <p>“Q” and “U” should stay together (like “queen”).</p>
183
- </li><li>
184
- <p>A lot of the time, the words won&#39;t look how they&#39;re supposed to sound, as you go by how the word <em>used</em> to sound, not how it&#39;s spelled. For instance, <code>$ spoonerize two new cuties</code> becomes “no cew twuties”, but it would be pronounced “new coo tooties”, as the words retain their original sounds.</p>
185
- </li></ul>
215
+ <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;spoonerize&#39;</span>
216
+
217
+ <span class="ruby-identifier">spoonerism</span> = <span class="ruby-constant">Spoonerize</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">s</span><span class="ruby-operator">|</span>
218
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">reverse</span> = <span class="ruby-keyword">true</span>
219
+ <span class="ruby-keyword">end</span>
220
+
221
+ <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">spoonerize</span>
222
+ <span class="ruby-comment"># =&gt; shot noo tabby</span>
223
+
224
+ <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">reverse</span> = <span class="ruby-keyword">false</span>
225
+ <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">spoonerize</span>
226
+ <span class="ruby-comment"># =&gt; tot shoo nabby</span>
227
+
228
+ <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">logfile_name</span> = <span class="ruby-string">&#39;~/.cache/spoonerize/spoonerize.csv&#39;</span>
229
+ <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">save</span>
230
+ </pre>
231
+
232
+ <p>You can also use the <a href="#config-file">config file</a>, 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 <code>#load_config_file</code>.</p>
233
+
234
+ <pre class="ruby"><span class="ruby-comment"># Config file would be automatically loaded before block is executed.</span>
235
+ <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">&#39;~/.spoonerize.yml&#39;</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sp</span><span class="ruby-operator">|</span>
236
+ <span class="ruby-identifier">sp</span>.<span class="ruby-identifier">reverse</span> = <span class="ruby-keyword">true</span>
237
+ <span class="ruby-keyword">end</span>
238
+
239
+ <span class="ruby-comment"># Config file would need to be manually loaded.</span>
240
+ <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>
241
+ <span class="ruby-identifier">sp</span>.<span class="ruby-identifier">config_file</span> = <span class="ruby-string">&#39;~/.spoonerize.yml&#39;</span>
242
+ <span class="ruby-keyword">end</span>
243
+
244
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">load_config_file</span>
245
+ </pre>
186
246
 
187
247
  <h2 id="label-Self+Promotion">Self Promotion<span><a href="#label-Self+Promotion">&para;</a> <a href="#top">&uarr;</a></span></h2>
188
248
 
@@ -194,7 +194,7 @@
194
194
 
195
195
  <div class="method-description">
196
196
 
197
- <p>Creates an instance of <code>StandupMD</code> and runs what the user requested.</p>
197
+ <p>Creates an instance of <code>Spoonerism</code> and runs what the user requested.</p>
198
198
 
199
199
  <p>@param [Array] options</p>
200
200
 
@@ -299,7 +299,7 @@
299
299
 
300
300
 
301
301
  <div class="method-source-code" id="longest_word_length-source">
302
- <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 102</span>
302
+ <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 103</span>
303
303
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">longest_word_length</span>
304
304
  <span class="ruby-ivar">@longest_word_length</span> <span class="ruby-operator">||=</span>
305
305
  <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">spoonerize</span>.<span class="ruby-identifier">group_by</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:size</span>).<span class="ruby-identifier">max</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">size</span>
@@ -335,7 +335,7 @@
335
335
 
336
336
 
337
337
  <div class="method-source-code" id="map-3F-source">
338
- <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 86</span>
338
+ <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 87</span>
339
339
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">map?</span>
340
340
  <span class="ruby-ivar">@map</span>
341
341
  <span class="ruby-keyword">end</span></pre>
@@ -370,7 +370,7 @@
370
370
 
371
371
 
372
372
  <div class="method-source-code" id="print-3F-source">
373
- <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 94</span>
373
+ <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 95</span>
374
374
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print?</span>
375
375
  <span class="ruby-ivar">@print</span>
376
376
  <span class="ruby-keyword">end</span></pre>
@@ -405,7 +405,7 @@
405
405
 
406
406
 
407
407
  <div class="method-source-code" id="print_log-source">
408
- <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 111</span>
408
+ <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 112</span>
409
409
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print_log</span>
410
410
  <span class="ruby-identifier">s</span> = <span class="ruby-constant">Spoonerize</span><span class="ruby-operator">::</span><span class="ruby-constant">Log</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">logfile_name</span>)
411
411
  <span class="ruby-identifier">s</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-identifier">print</span> <span class="ruby-identifier">row</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; | &#39;</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;\n&quot;</span> }
@@ -441,7 +441,7 @@
441
441
 
442
442
 
443
443
  <div class="method-source-code" id="print_mappings-source">
444
- <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 120</span>
444
+ <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 121</span>
445
445
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">print_mappings</span>
446
446
  <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">to_h</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
447
447
  <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;%-#{longest_word_length}s =&gt; %s&quot;</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>]
@@ -478,7 +478,7 @@
478
478
 
479
479
 
480
480
  <div class="method-source-code" id="save-3F-source">
481
- <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 78</span>
481
+ <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 79</span>
482
482
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">save?</span>
483
483
  <span class="ruby-ivar">@save</span>
484
484
  <span class="ruby-keyword">end</span></pre>
@@ -515,7 +515,8 @@
515
515
  <div class="method-source-code" id="spoonerism-source">
516
516
  <pre><span class="ruby-comment"># File lib/spoonerize/cli.rb, line 68</span>
517
517
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">spoonerism</span>
518
- <span class="ruby-ivar">@spoonerism</span> <span class="ruby-operator">||=</span> <span class="ruby-operator">::</span><span class="ruby-constant">Spoonerize</span><span class="ruby-operator">::</span><span class="ruby-constant">Spoonerism</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
518
+ <span class="ruby-identifier">pf</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-constant">PREFERENCE_FILE</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">PREFERENCE_FILE</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
519
+ <span class="ruby-ivar">@spoonerism</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Spoonerism</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">options</span>, <span class="ruby-identifier">pf</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
519
520
  <span class="ruby-identifier">preferences</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">s</span>.<span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;#{k}=&quot;</span>, <span class="ruby-identifier">v</span>) }
520
521
  <span class="ruby-keyword">end</span>
521
522
  <span class="ruby-keyword">end</span></pre>
@@ -79,10 +79,16 @@
79
79
 
80
80
  <li ><a href="#method-i-all_excluded_words">#all_excluded_words</a>
81
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
+
82
86
  <li ><a href="#method-i-enough_flippable_words-3F">#enough_flippable_words?</a>
83
87
 
84
88
  <li ><a href="#method-i-lazy-3F">#lazy?</a>
85
89
 
90
+ <li ><a href="#method-i-load_config_file">#load_config_file</a>
91
+
86
92
  <li ><a href="#method-i-reverse-3F">#reverse?</a>
87
93
 
88
94
  <li ><a href="#method-i-save">#save</a>
@@ -127,6 +133,36 @@
127
133
  </header>
128
134
 
129
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
+
130
166
  <div id="attribute-i-excluded_words" class="method-detail">
131
167
  <div class="method-heading attribute-method-heading">
132
168
  <span class="method-name">excluded_words</span><span
@@ -224,7 +260,7 @@
224
260
 
225
261
  <div class="method-heading">
226
262
  <span class="method-name">new</span><span
227
- class="method-args">(words) { |self| ... }</span>
263
+ class="method-args">(words, config_file = nil) { |self| ... }</span>
228
264
 
229
265
  <span class="method-click-advice">click to toggle source</span>
230
266
 
@@ -233,23 +269,45 @@
233
269
 
234
270
  <div class="method-description">
235
271
 
236
- <p>Initialize instance and raise if there aren&#39;t enough words to flip.</p>
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>
237
273
 
238
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">&#39;~/.spoonerize.yml&#39;</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">&#39;~/.spoonerize.yml&#39;</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>
239
291
 
240
292
 
241
293
 
242
294
 
243
295
  <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>)
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> = {}
246
299
  <span class="ruby-ivar">@excluded_words</span> = []
247
300
  <span class="ruby-ivar">@words</span> = <span class="ruby-identifier">words</span>.<span class="ruby-identifier">map</span>(<span class="ruby-operator">&amp;</span><span class="ruby-value">:downcase</span>)
248
301
  <span class="ruby-ivar">@lazy</span> = <span class="ruby-keyword">false</span>
249
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">&amp;&amp;</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>
250
305
  <span class="ruby-ivar">@logfile_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(
251
306
  <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">ENV</span>[<span class="ruby-string">&#39;HOME&#39;</span>], <span class="ruby-string">&#39;.cache&#39;</span>, <span class="ruby-string">&#39;spoonerize&#39;</span>, <span class="ruby-string">&#39;spoonerize.csv&#39;</span>)
252
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
+
253
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>
254
312
  <span class="ruby-keyword">end</span></pre>
255
313
  </div>
@@ -296,7 +354,7 @@
296
354
 
297
355
 
298
356
  <div class="method-source-code" id="all_excluded_words-source">
299
- <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 114</span>
357
+ <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 160</span>
300
358
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">all_excluded_words</span>
301
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">&amp;</span><span class="ruby-value">:downcase</span>)
302
360
  <span class="ruby-keyword">end</span></pre>
@@ -307,6 +365,78 @@
307
365
 
308
366
 
309
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
+
310
440
  </div>
311
441
 
312
442
 
@@ -329,7 +459,7 @@
329
459
 
330
460
 
331
461
  <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>
462
+ <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 133</span>
333
463
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">enough_flippable_words?</span>
334
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">&gt;</span> <span class="ruby-value">1</span>
335
465
  <span class="ruby-keyword">end</span></pre>
@@ -362,7 +492,7 @@
362
492
 
363
493
 
364
494
  <div class="method-source-code" id="lazy-3F-source">
365
- <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 93</span>
495
+ <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 139</span>
366
496
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">lazy?</span>
367
497
  <span class="ruby-ivar">@lazy</span>
368
498
  <span class="ruby-keyword">end</span></pre>
@@ -373,6 +503,45 @@
373
503
 
374
504
 
375
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">&#39;No config file set&#39;</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">&quot;File #{config_file} does not exist&quot;</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">&quot;#{k}=&quot;</span>, <span class="ruby-identifier">v</span>) }
537
+ <span class="ruby-keyword">end</span></pre>
538
+ </div>
539
+
540
+ </div>
541
+
542
+
543
+
544
+
376
545
  </div>
377
546
 
378
547
 
@@ -395,7 +564,7 @@
395
564
 
396
565
 
397
566
  <div class="method-source-code" id="reverse-3F-source">
398
- <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 99</span>
567
+ <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 145</span>
399
568
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">reverse?</span>
400
569
  <span class="ruby-ivar">@reverse</span>
401
570
  <span class="ruby-keyword">end</span></pre>
@@ -428,7 +597,7 @@
428
597
 
429
598
 
430
599
  <div class="method-source-code" id="save-source">
431
- <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 105</span>
600
+ <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 151</span>
432
601
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">save</span>
433
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">&#39; &#39;</span>), <span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">options</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39;, &#39;</span>)])
434
603
  <span class="ruby-keyword">end</span></pre>
@@ -461,7 +630,7 @@
461
630
 
462
631
 
463
632
  <div class="method-source-code" id="spoonerize-source">
464
- <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 62</span>
633
+ <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 100</span>
465
634
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">spoonerize</span>
466
635
  <span class="ruby-identifier">raise</span> <span class="ruby-constant">JakPibError</span>, <span class="ruby-string">&#39;Not enough words to flip&#39;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">enough_flippable_words?</span>
467
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>) }
@@ -495,7 +664,7 @@
495
664
 
496
665
 
497
666
  <div class="method-source-code" id="to_h-source">
498
- <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 75</span>
667
+ <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 113</span>
499
668
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_h</span>
500
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>)]
501
670
  <span class="ruby-keyword">end</span></pre>
@@ -528,7 +697,7 @@
528
697
 
529
698
 
530
699
  <div class="method-source-code" id="to_json-source">
531
- <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 81</span>
700
+ <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 119</span>
532
701
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_json</span>
533
702
  <span class="ruby-identifier">to_h</span>.<span class="ruby-identifier">to_json</span>
534
703
  <span class="ruby-keyword">end</span></pre>
@@ -561,7 +730,7 @@
561
730
 
562
731
 
563
732
  <div class="method-source-code" id="to_s-source">
564
- <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 69</span>
733
+ <pre><span class="ruby-comment"># File lib/spoonerize/spoonerism.rb, line 107</span>
565
734
  <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_s</span>
566
735
  <span class="ruby-identifier">spoonerize</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>)
567
736
  <span class="ruby-keyword">end</span></pre>