spoonerize 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/README.md +2 -4
  4. data/Rakefile +1 -1
  5. data/lib/spoonerize/version.rb +1 -1
  6. data/spoonerize.gemspec +1 -1
  7. metadata +3 -53
  8. data/doc/README_md.html +0 -238
  9. data/doc/Spoonerize.html +0 -125
  10. data/doc/Spoonerize/Bumper.html +0 -287
  11. data/doc/Spoonerize/Cli.html +0 -545
  12. data/doc/Spoonerize/Log.html +0 -362
  13. data/doc/Spoonerize/Spoonerism.html +0 -759
  14. data/doc/created.rid +0 -8
  15. data/doc/css/fonts.css +0 -167
  16. data/doc/css/rdoc.css +0 -619
  17. data/doc/fonts/Lato-Light.ttf +0 -0
  18. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  19. data/doc/fonts/Lato-Regular.ttf +0 -0
  20. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  21. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  22. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  23. data/doc/images/add.png +0 -0
  24. data/doc/images/arrow_up.png +0 -0
  25. data/doc/images/brick.png +0 -0
  26. data/doc/images/brick_link.png +0 -0
  27. data/doc/images/bug.png +0 -0
  28. data/doc/images/bullet_black.png +0 -0
  29. data/doc/images/bullet_toggle_minus.png +0 -0
  30. data/doc/images/bullet_toggle_plus.png +0 -0
  31. data/doc/images/date.png +0 -0
  32. data/doc/images/delete.png +0 -0
  33. data/doc/images/find.png +0 -0
  34. data/doc/images/loadingAnimation.gif +0 -0
  35. data/doc/images/macFFBgHack.png +0 -0
  36. data/doc/images/package.png +0 -0
  37. data/doc/images/page_green.png +0 -0
  38. data/doc/images/page_white_text.png +0 -0
  39. data/doc/images/page_white_width.png +0 -0
  40. data/doc/images/plugin.png +0 -0
  41. data/doc/images/ruby.png +0 -0
  42. data/doc/images/tag_blue.png +0 -0
  43. data/doc/images/tag_green.png +0 -0
  44. data/doc/images/transparent.png +0 -0
  45. data/doc/images/wrench.png +0 -0
  46. data/doc/images/wrench_orange.png +0 -0
  47. data/doc/images/zoom.png +0 -0
  48. data/doc/index.html +0 -241
  49. data/doc/js/darkfish.js +0 -84
  50. data/doc/js/navigation.js +0 -105
  51. data/doc/js/navigation.js.gz +0 -0
  52. data/doc/js/search.js +0 -110
  53. data/doc/js/search_index.js +0 -1
  54. data/doc/js/search_index.js.gz +0 -0
  55. data/doc/js/searcher.js +0 -229
  56. data/doc/js/searcher.js.gz +0 -0
  57. data/doc/table_of_contents.html +0 -257
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/doc/images/add.png DELETED
Binary file
Binary file
data/doc/images/brick.png DELETED
Binary file
Binary file
data/doc/images/bug.png DELETED
Binary file
Binary file
Binary file
Binary file
data/doc/images/date.png DELETED
Binary file
Binary file
data/doc/images/find.png DELETED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/doc/images/ruby.png DELETED
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
data/doc/images/zoom.png DELETED
Binary file
data/doc/index.html DELETED
@@ -1,241 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>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="file">
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
-
42
- <div id="search-section" role="search" class="project-section initially-hidden">
43
- <form action="#" method="get" accept-charset="utf-8">
44
- <div id="search-field-wrapper">
45
- <input id="search-field" role="combobox" aria-label="Search"
46
- aria-autocomplete="list" aria-controls="search-results"
47
- type="text" name="search" placeholder="Search" spellcheck="false"
48
- title="Type to search, Up and Down to navigate, Enter to load">
49
- </div>
50
-
51
- <ul id="search-results" aria-label="Search Results"
52
- aria-busy="false" aria-expanded="false"
53
- aria-atomic="false" class="initially-hidden"></ul>
54
- </form>
55
- </div>
56
-
57
- </div>
58
-
59
- <div id="project-metadata">
60
- <div id="fileindex-section" class="nav-section">
61
- <h3>Pages</h3>
62
-
63
- <ul class="link-list">
64
-
65
- <li><a href="./README_md.html">README</a>
66
-
67
- </ul>
68
- </div>
69
-
70
- <div id="classindex-section" class="nav-section">
71
- <h3>Class and Module Index</h3>
72
-
73
- <ul class="link-list">
74
-
75
- <li><a href="./Spoonerize.html">Spoonerize</a>
76
-
77
- <li><a href="./Spoonerize/Bumper.html">Spoonerize::Bumper</a>
78
-
79
- <li><a href="./Spoonerize/Cli.html">Spoonerize::Cli</a>
80
-
81
- <li><a href="./Spoonerize/Log.html">Spoonerize::Log</a>
82
-
83
- <li><a href="./Spoonerize/Spoonerism.html">Spoonerize::Spoonerism</a>
84
-
85
- </ul>
86
- </div>
87
-
88
- </div>
89
- </nav>
90
-
91
- <main role="main">
92
-
93
-
94
- <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>
95
-
96
- <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>
97
-
98
- <blockquote>
99
- <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>
100
- </blockquote>
101
-
102
- <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>
103
-
104
- <h2 id="label-About">About<span><a href="#label-About">&para;</a> <a href="#top">&uarr;</a></span></h2>
105
-
106
- <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>
107
- <ul><li>
108
- <p>Each word drops its leading consonant group and takes the leading consonant group of the next word.</p>
109
- </li><li>
110
- <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>
111
- </li><li>
112
- <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>
113
- </li><li>
114
- <p>When being “lazy”, common words (“the”, “his”, etc.) remain unchanged.</p>
115
- </li><li>
116
- <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>
117
- </li><li>
118
- <p>“Q” and “U” should stay together (like “queen”).</p>
119
- </li><li>
120
- <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>
121
- </li></ul>
122
-
123
- <h2 id="label-Installation">Installation<span><a href="#label-Installation">&para;</a> <a href="#top">&uarr;</a></span></h2>
124
-
125
- <h3 id="label-Automated">Automated<span><a href="#label-Automated">&para;</a> <a href="#top">&uarr;</a></span></h3>
126
-
127
- <p>Just install the gem!</p>
128
-
129
- <pre class="ruby"><span class="ruby-identifier">gem</span> <span class="ruby-identifier">install</span> <span class="ruby-identifier">spoonerize</span>
130
- </pre>
131
-
132
- <p>If you don&#39;t have permission on your system to install ruby or gems, I recommend using <a href="http://www.rubyinside.com/rbenv-a-simple-new-ruby-version-management-tool-5302.html">rbenv</a>, or you can try the manual methods below.</p>
133
-
134
- <h3 id="label-Manual">Manual<span><a href="#label-Manual">&para;</a> <a href="#top">&uarr;</a></span></h3>
135
-
136
- <p>From your terminal, clone the repository where you want it. From there, you have a couple of installation options.</p>
137
-
138
- <pre>git clone https://github.com/evanthegrayt/spoonerize.git
139
- cd spoonerize
140
-
141
- # Use rake to build and install the gem.
142
- rake install
143
-
144
- # OR manually link the executable somewhere. If you use this method, you cannot
145
- # move the repository after you link it!
146
- ln -s $PWD/bin/spoonerize /usr/local/bin/spoonerize</pre>
147
-
148
- <h2 id="label-Command+Line+Usage">Command Line Usage<span><a href="#label-Command+Line+Usage">&para;</a> <a href="#top">&uarr;</a></span></h2>
149
-
150
- <p>Call the executable and pass a phrase as arguments:</p>
151
-
152
- <pre>$ spoonerize not too shabby # =&gt; tot shoo nabby</pre>
153
-
154
- <p>If it didn&#39;t flip the way you wanted it to, you can reverse it:</p>
155
-
156
- <pre>$ spoonerize -r not too shabby # =&gt; shot noo tabby</pre>
157
-
158
- <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>
159
-
160
- <pre>$ spoonerize -s not too shabby
161
- Saving [tot shoo nabby] to ~/.cache/spoonerize/spoonerize.csv
162
-
163
- $ spoonerize -rs not too shabby
164
- Saving [shot noo tabby] to ~/.cache/spoonerize/spoonerize.csv
165
-
166
- $ spoonerize -p
167
- not too shabby | tot shoo nabby | No Options
168
- not too shabby | shot noo tabby | Reverse</pre>
169
-
170
- <p>Here is a list of all available options:</p>
171
-
172
- <pre>-r, --[no-]reverse Reverse flipping
173
- -l, --[no-]lazy Skip small words
174
- -m, --[no-]map Print words mapping
175
- -p, --[no-]print Print all entries in the log
176
- -s, --[no-]save Save results in log
177
- --exclude=WORDS Words to skip</pre>
178
-
179
- <h3 id="label-Config+File">Config File<span><a href="#label-Config+File">&para;</a> <a href="#top">&uarr;</a></span></h3>
180
-
181
- <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>
182
-
183
- <pre># Setting Default
184
- excluded_words: []
185
- lazy: false
186
- reverse: false
187
- logfile_name: &#39;~/.cache/spoonerize/spoonerize.csv&#39;</pre>
188
-
189
- <p>Options set by this file can be overridden at runtime by the use of the executable&#39;s flags.</p>
190
-
191
- <h2 id="label-API">API<span><a href="#label-API">&para;</a> <a href="#top">&uarr;</a></span></h2>
192
-
193
- <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>
194
-
195
- <pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;spoonerize&#39;</span>
196
-
197
- <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>
198
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">reverse</span> = <span class="ruby-keyword">true</span>
199
- <span class="ruby-keyword">end</span>
200
-
201
- <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">spoonerize</span>
202
- <span class="ruby-comment"># =&gt; shot noo tabby</span>
203
-
204
- <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">reverse</span> = <span class="ruby-keyword">false</span>
205
- <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">spoonerize</span>
206
- <span class="ruby-comment"># =&gt; tot shoo nabby</span>
207
-
208
- <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">logfile_name</span> = <span class="ruby-string">&#39;~/.cache/spoonerize/spoonerize.csv&#39;</span>
209
- <span class="ruby-identifier">spoonerism</span>.<span class="ruby-identifier">save</span>
210
- </pre>
211
-
212
- <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>
213
-
214
- <pre class="ruby"><span class="ruby-comment"># Config file would be automatically loaded before block is executed.</span>
215
- <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>
216
- <span class="ruby-identifier">sp</span>.<span class="ruby-identifier">reverse</span> = <span class="ruby-keyword">true</span>
217
- <span class="ruby-keyword">end</span>
218
-
219
- <span class="ruby-comment"># Config file would need to be manually loaded.</span>
220
- <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>
221
- <span class="ruby-identifier">sp</span>.<span class="ruby-identifier">config_file</span> = <span class="ruby-string">&#39;~/.spoonerize.yml&#39;</span>
222
- <span class="ruby-keyword">end</span>
223
-
224
- <span class="ruby-identifier">s</span>.<span class="ruby-identifier">load_config_file</span>
225
- </pre>
226
-
227
- <h2 id="label-Self+Promotion">Self Promotion<span><a href="#label-Self+Promotion">&para;</a> <a href="#top">&uarr;</a></span></h2>
228
-
229
- <p>I do these projects for fun, and I enjoy knowing that they&#39;re helpful to people. Consider starring <a href="https://github.com/evanthegrayt/spoonerize">the repository</a> if you like it! If you love it, follow me <a href="https://github.com/evanthegrayt">on github</a>!</p>
230
-
231
-
232
- </main>
233
-
234
-
235
-
236
- <footer id="validator-badges" role="contentinfo">
237
- <p><a href="https://validator.w3.org/check/referer">Validate</a>
238
- <p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.2.1.
239
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
240
- </footer>
241
-
data/doc/js/darkfish.js DELETED
@@ -1,84 +0,0 @@
1
- /**
2
- *
3
- * Darkfish Page Functions
4
- * $Id: darkfish.js 53 2009-01-07 02:52:03Z deveiant $
5
- *
6
- * Author: Michael Granger <mgranger@laika.com>
7
- *
8
- */
9
-
10
- /* Provide console simulation for firebug-less environments */
11
- /*
12
- if (!("console" in window) || !("firebug" in console)) {
13
- var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
14
- "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
15
-
16
- window.console = {};
17
- for (var i = 0; i < names.length; ++i)
18
- window.console[names[i]] = function() {};
19
- };
20
- */
21
-
22
-
23
- function showSource( e ) {
24
- var target = e.target;
25
- while (!target.classList.contains('method-detail')) {
26
- target = target.parentNode;
27
- }
28
- if (typeof target !== "undefined" && target !== null) {
29
- target = target.querySelector('.method-source-code');
30
- }
31
- if (typeof target !== "undefined" && target !== null) {
32
- target.classList.toggle('active-menu')
33
- }
34
- };
35
-
36
- function hookSourceViews() {
37
- document.querySelectorAll('.method-heading').forEach(function (codeObject) {
38
- codeObject.addEventListener('click', showSource);
39
- });
40
- };
41
-
42
- function hookSearch() {
43
- var input = document.querySelector('#search-field');
44
- var result = document.querySelector('#search-results');
45
- result.classList.remove("initially-hidden");
46
-
47
- var search_section = document.querySelector('#search-section');
48
- search_section.classList.remove("initially-hidden");
49
-
50
- var search = new Search(search_data, input, result);
51
-
52
- search.renderItem = function(result) {
53
- var li = document.createElement('li');
54
- var html = '';
55
-
56
- // TODO add relative path to <script> per-page
57
- html += '<p class="search-match"><a href="' + index_rel_prefix + result.path + '">' + this.hlt(result.title);
58
- if (result.params)
59
- html += '<span class="params">' + result.params + '</span>';
60
- html += '</a>';
61
-
62
-
63
- if (result.namespace)
64
- html += '<p class="search-namespace">' + this.hlt(result.namespace);
65
-
66
- if (result.snippet)
67
- html += '<div class="search-snippet">' + result.snippet + '</div>';
68
-
69
- li.innerHTML = html;
70
-
71
- return li;
72
- }
73
-
74
- search.select = function(result) {
75
- window.location.href = result.firstChild.firstChild.href;
76
- }
77
-
78
- search.scrollIntoView = search.scrollInWindow;
79
- };
80
-
81
- document.addEventListener('DOMContentLoaded', function() {
82
- hookSourceViews();
83
- hookSearch();
84
- });
data/doc/js/navigation.js DELETED
@@ -1,105 +0,0 @@
1
- /*
2
- * Navigation allows movement using the arrow keys through the search results.
3
- *
4
- * When using this library you will need to set scrollIntoView to the
5
- * appropriate function for your layout. Use scrollInWindow if the container
6
- * is not scrollable and scrollInElement if the container is a separate
7
- * scrolling region.
8
- */
9
- Navigation = new function() {
10
- this.initNavigation = function() {
11
- var _this = this;
12
-
13
- document.addEventListener('keydown', function(e) {
14
- _this.onkeydown(e);
15
- });
16
-
17
- this.navigationActive = true;
18
- }
19
-
20
- this.setNavigationActive = function(state) {
21
- this.navigationActive = state;
22
- }
23
-
24
- this.onkeydown = function(e) {
25
- if (!this.navigationActive) return;
26
- switch(e.keyCode) {
27
- case 37: //Event.KEY_LEFT:
28
- if (this.moveLeft()) e.preventDefault();
29
- break;
30
- case 38: //Event.KEY_UP:
31
- if (e.keyCode == 38 || e.ctrlKey) {
32
- if (this.moveUp()) e.preventDefault();
33
- }
34
- break;
35
- case 39: //Event.KEY_RIGHT:
36
- if (this.moveRight()) e.preventDefault();
37
- break;
38
- case 40: //Event.KEY_DOWN:
39
- if (e.keyCode == 40 || e.ctrlKey) {
40
- if (this.moveDown()) e.preventDefault();
41
- }
42
- break;
43
- case 13: //Event.KEY_RETURN:
44
- if (this.current) e.preventDefault();
45
- this.select(this.current);
46
- break;
47
- }
48
- if (e.ctrlKey && e.shiftKey) this.select(this.current);
49
- }
50
-
51
- this.moveRight = function() {
52
- }
53
-
54
- this.moveLeft = function() {
55
- }
56
-
57
- this.move = function(isDown) {
58
- }
59
-
60
- this.moveUp = function() {
61
- return this.move(false);
62
- }
63
-
64
- this.moveDown = function() {
65
- return this.move(true);
66
- }
67
-
68
- /*
69
- * Scrolls to the given element in the scrollable element view.
70
- */
71
- this.scrollInElement = function(element, view) {
72
- var offset, viewHeight, viewScroll, height;
73
- offset = element.offsetTop;
74
- height = element.offsetHeight;
75
- viewHeight = view.offsetHeight;
76
- viewScroll = view.scrollTop;
77
-
78
- if (offset - viewScroll + height > viewHeight) {
79
- view.scrollTop = offset - viewHeight + height;
80
- }
81
- if (offset < viewScroll) {
82
- view.scrollTop = offset;
83
- }
84
- }
85
-
86
- /*
87
- * Scrolls to the given element in the window. The second argument is
88
- * ignored
89
- */
90
- this.scrollInWindow = function(element, ignored) {
91
- var offset, viewHeight, viewScroll, height;
92
- offset = element.offsetTop;
93
- height = element.offsetHeight;
94
- viewHeight = window.innerHeight;
95
- viewScroll = window.scrollY;
96
-
97
- if (offset - viewScroll + height > viewHeight) {
98
- window.scrollTo(window.scrollX, offset - viewHeight + height);
99
- }
100
- if (offset < viewScroll) {
101
- window.scrollTo(window.scrollX, offset);
102
- }
103
- }
104
- }
105
-