wwwjdic 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +419 -0
- data/COPYING.md +675 -0
- data/Gemfile +21 -0
- data/README.md +303 -0
- data/Rakefile +52 -0
- data/acknowledgements.md +55 -0
- data/authors.md +67 -0
- data/copyright.md +377 -0
- data/examples/basics.rb +117 -0
- data/examples/translate.rb +128 -0
- data/examples/uri.rb +129 -0
- data/html/CHANGELOG.html +597 -0
- data/html/COPYING_md.html +389 -0
- data/html/Gemfile.html +104 -0
- data/html/Object.html +185 -0
- data/html/README_md.html +343 -0
- data/html/Rakefile.html +137 -0
- data/html/WWWJDic/ParsableDuckType.html +159 -0
- data/html/WWWJDic/Parser.html +233 -0
- data/html/WWWJDic/Parsers/Dict.html +191 -0
- data/html/WWWJDic/Parsers/Display.html +184 -0
- data/html/WWWJDic/Parsers/Key.html +221 -0
- data/html/WWWJDic/Parsers/Search.html +214 -0
- data/html/WWWJDic/Parsers/Server.html +182 -0
- data/html/WWWJDic/Parsers.html +96 -0
- data/html/WWWJDic/Splitter.html +378 -0
- data/html/WWWJDic/Utils/Downloader/Downloader.html +227 -0
- data/html/WWWJDic/Utils/Downloader.html +108 -0
- data/html/WWWJDic/Utils/Raisers.html +235 -0
- data/html/WWWJDic/Utils.html +108 -0
- data/html/WWWJDic/WWWJDic.html +715 -0
- data/html/WWWJDic.html +348 -0
- data/html/acknowledgements_md.html +149 -0
- data/html/authors_md.html +181 -0
- data/html/copyright_md.html +422 -0
- data/html/created.rid +59 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +590 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +363 -0
- data/html/js/darkfish.js +161 -0
- data/html/js/jquery.js +4 -0
- data/html/js/navigation.js +141 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +109 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +541 -0
- data/html/wwwjdic_gemspec.html +161 -0
- data/lib/wwwjdic/application.rb +233 -0
- data/lib/wwwjdic/constants.rb +113 -0
- data/lib/wwwjdic/locales/de.yml +29 -0
- data/lib/wwwjdic/locales/en.yml +29 -0
- data/lib/wwwjdic/locales/es.yml +29 -0
- data/lib/wwwjdic/locales/fr.yml +29 -0
- data/lib/wwwjdic/locales/hu.yml +29 -0
- data/lib/wwwjdic/locales/it.yml +29 -0
- data/lib/wwwjdic/locales/ja.yml +30 -0
- data/lib/wwwjdic/locales/nl.yml +29 -0
- data/lib/wwwjdic/locales/ru.yml +29 -0
- data/lib/wwwjdic/locales/sl.yml +29 -0
- data/lib/wwwjdic/locales/sv.yml +29 -0
- data/lib/wwwjdic/parser.rb +46 -0
- data/lib/wwwjdic/parsers/dict.rb +58 -0
- data/lib/wwwjdic/parsers/display.rb +50 -0
- data/lib/wwwjdic/parsers/key.rb +75 -0
- data/lib/wwwjdic/parsers/search.rb +60 -0
- data/lib/wwwjdic/parsers/server.rb +47 -0
- data/lib/wwwjdic/utils/downloader.rb +135 -0
- data/lib/wwwjdic/utils/raisers.rb +67 -0
- data/lib/wwwjdic/utils/splitter.rb +84 -0
- data/lib/wwwjdic/version.rb +20 -0
- data/lib/wwwjdic.rb +57 -0
- data/test/test_helper.rb +40 -0
- data/test/test_wwwjdic.rb +32 -0
- data/test/wwwjdic/locales/de.yml +22 -0
- data/test/wwwjdic/locales/en.yml +22 -0
- data/test/wwwjdic/locales/es.yml +22 -0
- data/test/wwwjdic/locales/fr.yml +22 -0
- data/test/wwwjdic/locales/hu.yml +22 -0
- data/test/wwwjdic/locales/it.yml +21 -0
- data/test/wwwjdic/locales/ja.yml +23 -0
- data/test/wwwjdic/locales/nl.yml +22 -0
- data/test/wwwjdic/locales/ru.yml +22 -0
- data/test/wwwjdic/locales/sl.yml +22 -0
- data/test/wwwjdic/locales/sv.yml +22 -0
- data/test/wwwjdic/locales/test_locales.rb +65 -0
- data/test/wwwjdic/parsers/test_dict.rb +73 -0
- data/test/wwwjdic/parsers/test_display.rb +51 -0
- data/test/wwwjdic/parsers/test_key.rb +52 -0
- data/test/wwwjdic/parsers/test_server.rb +51 -0
- data/test/wwwjdic/test_application.rb +219 -0
- data/test/wwwjdic/test_parsable_duck_type.rb +37 -0
- data/test/wwwjdic/utils/test_downloader.rb +41 -0
- data/test/wwwjdic/utils/test_raisers.rb +59 -0
- data/wwwjdic.gemspec +74 -0
- metadata +309 -0
@@ -0,0 +1,378 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class WWWJDic::Splitter - wwwjdic 13.0.0</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../";
|
11
|
+
var index_rel_prefix = "../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../js/jquery.js"></script>
|
15
|
+
<script src="../js/darkfish.js"></script>
|
16
|
+
|
17
|
+
<link href="../css/fonts.css" rel="stylesheet">
|
18
|
+
<link href="../css/rdoc.css" rel="stylesheet">
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" role="document" class="class">
|
24
|
+
<nav role="navigation">
|
25
|
+
<div id="project-navigation">
|
26
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
27
|
+
<h2>
|
28
|
+
<a href="../index.html" rel="home">Home</a>
|
29
|
+
</h2>
|
30
|
+
|
31
|
+
<div id="table-of-contents-navigation">
|
32
|
+
<a href="../table_of_contents.html#pages">Pages</a>
|
33
|
+
<a href="../table_of_contents.html#classes">Classes</a>
|
34
|
+
<a href="../table_of_contents.html#methods">Methods</a>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
39
|
+
<form action="#" method="get" accept-charset="utf-8">
|
40
|
+
<div id="search-field-wrapper">
|
41
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
42
|
+
aria-autocomplete="list" aria-controls="search-results"
|
43
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
44
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<ul id="search-results" aria-label="Search Results"
|
48
|
+
aria-busy="false" aria-expanded="false"
|
49
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
50
|
+
</form>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<div id="parent-class-section" class="nav-section">
|
60
|
+
<h3>Parent</h3>
|
61
|
+
|
62
|
+
|
63
|
+
<p class="link"><a href="../Object.html">Object</a>
|
64
|
+
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<!-- Method Quickref -->
|
70
|
+
<div id="method-list-section" class="nav-section">
|
71
|
+
<h3>Methods</h3>
|
72
|
+
|
73
|
+
<ul class="link-list" role="directory">
|
74
|
+
|
75
|
+
<li ><a href="#method-c-new">::new</a>
|
76
|
+
|
77
|
+
<li ><a href="#method-i-content">#content</a>
|
78
|
+
|
79
|
+
<li ><a href="#method-i-lines">#lines</a>
|
80
|
+
|
81
|
+
<li ><a href="#method-i-message">#message</a>
|
82
|
+
|
83
|
+
<li ><a href="#method-i-title">#title</a>
|
84
|
+
|
85
|
+
<li ><a href="#method-i-translation">#translation</a>
|
86
|
+
|
87
|
+
</ul>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
</div>
|
91
|
+
</nav>
|
92
|
+
|
93
|
+
<main role="main" aria-labelledby="class-WWWJDic::Splitter">
|
94
|
+
<h1 id="class-WWWJDic::Splitter" class="class">
|
95
|
+
class WWWJDic::Splitter
|
96
|
+
</h1>
|
97
|
+
|
98
|
+
<section class="description">
|
99
|
+
|
100
|
+
<p>This class is a simple API to interact with <a href="WWWJDic.html"><code>WWWJDic</code></a> Backboor Entry/API.</p>
|
101
|
+
<dl class="rdoc-list note-list"><dt>Author
|
102
|
+
<dd>
|
103
|
+
<p><a href="mailto:marcobresciani_1974@libero.it">Marco Bresciani</a></p>
|
104
|
+
</dd><dt>Copyright
|
105
|
+
<dd>
|
106
|
+
<p>Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani</p>
|
107
|
+
</dd><dt>License
|
108
|
+
<dd>
|
109
|
+
<p>GNU General Public License version 3</p>
|
110
|
+
</dd></dl>
|
111
|
+
|
112
|
+
</section>
|
113
|
+
|
114
|
+
|
115
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
126
|
+
<header>
|
127
|
+
<h3>Public Class Methods</h3>
|
128
|
+
</header>
|
129
|
+
|
130
|
+
|
131
|
+
<div id="method-c-new" class="method-detail ">
|
132
|
+
|
133
|
+
<div class="method-heading">
|
134
|
+
<span class="method-name">new</span><span
|
135
|
+
class="method-args">(translation)</span>
|
136
|
+
|
137
|
+
<span class="method-click-advice">click to toggle source</span>
|
138
|
+
|
139
|
+
</div>
|
140
|
+
|
141
|
+
|
142
|
+
<div class="method-description">
|
143
|
+
|
144
|
+
<p>Creates a <code>Splitter</code> object.</p>
|
145
|
+
<dl class="rdoc-list note-list"><dt>Usage
|
146
|
+
<dd>
|
147
|
+
<p><code>new_splitter = Splitter.new translation_content</code></p>
|
148
|
+
</dd><dt>Returns
|
149
|
+
<dd>
|
150
|
+
<p>a <code>Splitter</code> object.</p>
|
151
|
+
</dd></dl>
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
<div class="method-source-code" id="new-source">
|
157
|
+
<pre> <span class="ruby-comment"># File lib/wwwjdic/utils/splitter.rb</span>
|
158
|
+
<span class="line-num">37</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">translation</span>)
|
159
|
+
<span class="line-num">38</span> <span class="ruby-ivar">@translation</span> = <span class="ruby-identifier">translation</span>.<span class="ruby-identifier">force_encoding</span>(<span class="ruby-string">'UTF-8'</span>)
|
160
|
+
<span class="line-num">39</span> <span class="ruby-keyword">end</span></pre>
|
161
|
+
</div>
|
162
|
+
|
163
|
+
</div>
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
</div>
|
169
|
+
|
170
|
+
|
171
|
+
</section>
|
172
|
+
|
173
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
174
|
+
<header>
|
175
|
+
<h3>Public Instance Methods</h3>
|
176
|
+
</header>
|
177
|
+
|
178
|
+
|
179
|
+
<div id="method-i-content" class="method-detail ">
|
180
|
+
|
181
|
+
<div class="method-heading">
|
182
|
+
<span class="method-name">content</span><span
|
183
|
+
class="method-args">()</span>
|
184
|
+
|
185
|
+
<span class="method-click-advice">click to toggle source</span>
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
|
190
|
+
<div class="method-description">
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<div class="method-source-code" id="content-source">
|
198
|
+
<pre> <span class="ruby-comment"># File lib/wwwjdic/utils/splitter.rb</span>
|
199
|
+
<span class="line-num">63</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">content</span>
|
200
|
+
<span class="line-num">64</span> <span class="ruby-identifier">result</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
201
|
+
<span class="line-num">65</span> <span class="ruby-identifier">lines</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a_line</span><span class="ruby-operator">|</span>
|
202
|
+
<span class="line-num">66</span> <span class="ruby-identifier">inner</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
203
|
+
<span class="line-num">67</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/(.*)\[/m</span>.<span class="ruby-identifier">match</span> <span class="ruby-identifier">a_line</span>
|
204
|
+
<span class="line-num">68</span> <span class="ruby-identifier">inner</span>[<span class="ruby-value">:word</span>] = <span class="ruby-node">$1</span>.<span class="ruby-identifier">strip</span>
|
205
|
+
<span class="line-num">69</span> <span class="ruby-identifier">inner</span>[<span class="ruby-value">:kana</span>] = <span class="ruby-node">$1</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\[(.*)\]/m</span>.<span class="ruby-identifier">match</span> <span class="ruby-identifier">a_line</span>
|
206
|
+
<span class="line-num">70</span> <span class="ruby-identifier">inner</span>[<span class="ruby-value">:text</span>] = <span class="ruby-node">$1</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\] \/(.*)\//m</span>.<span class="ruby-identifier">match</span> <span class="ruby-identifier">a_line</span>
|
207
|
+
<span class="line-num">71</span> <span class="ruby-keyword">else</span>
|
208
|
+
<span class="line-num">72</span> <span class="ruby-identifier">inner</span>[<span class="ruby-value">:kana</span>] = <span class="ruby-node">$1</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/^(.*)(\s)\//m</span>.<span class="ruby-identifier">match</span> <span class="ruby-identifier">a_line</span>
|
209
|
+
<span class="line-num">73</span> <span class="ruby-identifier">inner</span>[<span class="ruby-value">:word</span>] = <span class="ruby-identifier">inner</span>[<span class="ruby-value">:kana</span>]
|
210
|
+
<span class="line-num">74</span> <span class="ruby-identifier">inner</span>[<span class="ruby-value">:text</span>] = <span class="ruby-node">$1</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/\/(.*)\//m</span>.<span class="ruby-identifier">match</span> <span class="ruby-identifier">a_line</span>
|
211
|
+
<span class="line-num">75</span> <span class="ruby-keyword">end</span>
|
212
|
+
<span class="line-num">76</span> <span class="ruby-identifier">inner</span>[<span class="ruby-value">:meanings</span>] = <span class="ruby-identifier">inner</span>[<span class="ruby-value">:text</span>].<span class="ruby-identifier">split</span>(<span class="ruby-string">'/'</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">inner</span>[<span class="ruby-value">:text</span>].<span class="ruby-identifier">include?</span> <span class="ruby-string">'/'</span>
|
213
|
+
<span class="line-num">77</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">inner</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">inner</span>.<span class="ruby-identifier">empty?</span>
|
214
|
+
<span class="line-num">78</span> <span class="ruby-keyword">end</span>
|
215
|
+
<span class="line-num">79</span>
|
216
|
+
<span class="line-num">80</span> <span class="ruby-identifier">result</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">empty?</span>
|
217
|
+
<span class="line-num">81</span> <span class="ruby-keyword">end</span></pre>
|
218
|
+
</div>
|
219
|
+
|
220
|
+
</div>
|
221
|
+
|
222
|
+
|
223
|
+
|
224
|
+
|
225
|
+
</div>
|
226
|
+
|
227
|
+
|
228
|
+
<div id="method-i-lines" class="method-detail ">
|
229
|
+
|
230
|
+
<div class="method-heading">
|
231
|
+
<span class="method-name">lines</span><span
|
232
|
+
class="method-args">()</span>
|
233
|
+
|
234
|
+
<span class="method-click-advice">click to toggle source</span>
|
235
|
+
|
236
|
+
</div>
|
237
|
+
|
238
|
+
|
239
|
+
<div class="method-description">
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
<div class="method-source-code" id="lines-source">
|
247
|
+
<pre> <span class="ruby-comment"># File lib/wwwjdic/utils/splitter.rb</span>
|
248
|
+
<span class="line-num">54</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">lines</span>
|
249
|
+
<span class="line-num">55</span> <span class="ruby-identifier">result</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
250
|
+
<span class="line-num">56</span> <span class="ruby-identifier">translation</span>.<span class="ruby-identifier">each_line</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a_line</span><span class="ruby-operator">|</span>
|
251
|
+
<span class="line-num">57</span> <span class="ruby-identifier">stripped_line</span> = <span class="ruby-identifier">a_line</span>.<span class="ruby-identifier">strip</span>
|
252
|
+
<span class="line-num">58</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">stripped_line</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">stripped_line</span>.<span class="ruby-identifier">empty?</span>
|
253
|
+
<span class="line-num">59</span> <span class="ruby-keyword">end</span>
|
254
|
+
<span class="line-num">60</span> <span class="ruby-identifier">result</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">empty?</span>
|
255
|
+
<span class="line-num">61</span> <span class="ruby-keyword">end</span></pre>
|
256
|
+
</div>
|
257
|
+
|
258
|
+
</div>
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
</div>
|
264
|
+
|
265
|
+
|
266
|
+
<div id="method-i-message" class="method-detail ">
|
267
|
+
|
268
|
+
<div class="method-heading">
|
269
|
+
<span class="method-name">message</span><span
|
270
|
+
class="method-args">()</span>
|
271
|
+
|
272
|
+
<span class="method-click-advice">click to toggle source</span>
|
273
|
+
|
274
|
+
</div>
|
275
|
+
|
276
|
+
|
277
|
+
<div class="method-description">
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
<div class="method-source-code" id="message-source">
|
285
|
+
<pre> <span class="ruby-comment"># File lib/wwwjdic/utils/splitter.rb</span>
|
286
|
+
<span class="line-num">49</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">message</span>
|
287
|
+
<span class="line-num">50</span> <span class="ruby-keyword">return</span> <span class="ruby-node">$1</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/<p>(.*)<p>/m</span>.<span class="ruby-identifier">match</span> <span class="ruby-ivar">@translation</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@translation</span>.<span class="ruby-identifier">nil?</span>
|
288
|
+
<span class="line-num">51</span> <span class="ruby-node">$1</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/<p>(.*)<pre>/m</span>.<span class="ruby-identifier">match</span> <span class="ruby-ivar">@translation</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@translation</span>.<span class="ruby-identifier">nil?</span>
|
289
|
+
<span class="line-num">52</span> <span class="ruby-keyword">end</span></pre>
|
290
|
+
</div>
|
291
|
+
|
292
|
+
</div>
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
</div>
|
298
|
+
|
299
|
+
|
300
|
+
<div id="method-i-title" class="method-detail ">
|
301
|
+
|
302
|
+
<div class="method-heading">
|
303
|
+
<span class="method-name">title</span><span
|
304
|
+
class="method-args">()</span>
|
305
|
+
|
306
|
+
<span class="method-click-advice">click to toggle source</span>
|
307
|
+
|
308
|
+
</div>
|
309
|
+
|
310
|
+
|
311
|
+
<div class="method-description">
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
<div class="method-source-code" id="title-source">
|
319
|
+
<pre> <span class="ruby-comment"># File lib/wwwjdic/utils/splitter.rb</span>
|
320
|
+
<span class="line-num">41</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">title</span>
|
321
|
+
<span class="line-num">42</span> <span class="ruby-node">$1</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/<TITLE>(.*)<\/TITLE>/</span>.<span class="ruby-identifier">match</span> <span class="ruby-ivar">@translation</span>
|
322
|
+
<span class="line-num">43</span> <span class="ruby-keyword">end</span></pre>
|
323
|
+
</div>
|
324
|
+
|
325
|
+
</div>
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
</div>
|
331
|
+
|
332
|
+
|
333
|
+
<div id="method-i-translation" class="method-detail ">
|
334
|
+
|
335
|
+
<div class="method-heading">
|
336
|
+
<span class="method-name">translation</span><span
|
337
|
+
class="method-args">()</span>
|
338
|
+
|
339
|
+
<span class="method-click-advice">click to toggle source</span>
|
340
|
+
|
341
|
+
</div>
|
342
|
+
|
343
|
+
|
344
|
+
<div class="method-description">
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<div class="method-source-code" id="translation-source">
|
352
|
+
<pre> <span class="ruby-comment"># File lib/wwwjdic/utils/splitter.rb</span>
|
353
|
+
<span class="line-num">45</span> <span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">translation</span>
|
354
|
+
<span class="line-num">46</span> <span class="ruby-node">$1</span>.<span class="ruby-identifier">strip</span> <span class="ruby-keyword">if</span> <span class="ruby-regexp">/<pre>(.*)<\/pre>/m</span>.<span class="ruby-identifier">match</span> <span class="ruby-ivar">@translation</span>
|
355
|
+
<span class="line-num">47</span> <span class="ruby-keyword">end</span></pre>
|
356
|
+
</div>
|
357
|
+
|
358
|
+
</div>
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
|
363
|
+
</div>
|
364
|
+
|
365
|
+
|
366
|
+
</section>
|
367
|
+
|
368
|
+
</section>
|
369
|
+
|
370
|
+
</main>
|
371
|
+
|
372
|
+
|
373
|
+
<footer id="validator-badges" role="contentinfo">
|
374
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
375
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.1.
|
376
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
377
|
+
</footer>
|
378
|
+
|
@@ -0,0 +1,227 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class WWWJDic::Utils::Downloader::Downloader - wwwjdic 13.0.0</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../../../";
|
11
|
+
var index_rel_prefix = "../../../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../../../js/jquery.js"></script>
|
15
|
+
<script src="../../../js/darkfish.js"></script>
|
16
|
+
|
17
|
+
<link href="../../../css/fonts.css" rel="stylesheet">
|
18
|
+
<link href="../../../css/rdoc.css" rel="stylesheet">
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" role="document" class="class">
|
24
|
+
<nav role="navigation">
|
25
|
+
<div id="project-navigation">
|
26
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
27
|
+
<h2>
|
28
|
+
<a href="../../../index.html" rel="home">Home</a>
|
29
|
+
</h2>
|
30
|
+
|
31
|
+
<div id="table-of-contents-navigation">
|
32
|
+
<a href="../../../table_of_contents.html#pages">Pages</a>
|
33
|
+
<a href="../../../table_of_contents.html#classes">Classes</a>
|
34
|
+
<a href="../../../table_of_contents.html#methods">Methods</a>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
39
|
+
<form action="#" method="get" accept-charset="utf-8">
|
40
|
+
<div id="search-field-wrapper">
|
41
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
42
|
+
aria-autocomplete="list" aria-controls="search-results"
|
43
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
44
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<ul id="search-results" aria-label="Search Results"
|
48
|
+
aria-busy="false" aria-expanded="false"
|
49
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
50
|
+
</form>
|
51
|
+
</div>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
<div id="class-metadata">
|
58
|
+
|
59
|
+
<div id="parent-class-section" class="nav-section">
|
60
|
+
<h3>Parent</h3>
|
61
|
+
|
62
|
+
|
63
|
+
<p class="link"><a href="../../../Object.html">Object</a>
|
64
|
+
|
65
|
+
</div>
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<!-- Method Quickref -->
|
70
|
+
<div id="method-list-section" class="nav-section">
|
71
|
+
<h3>Methods</h3>
|
72
|
+
|
73
|
+
<ul class="link-list" role="directory">
|
74
|
+
|
75
|
+
<li ><a href="#method-c-download_file">::download_file</a>
|
76
|
+
|
77
|
+
</ul>
|
78
|
+
</div>
|
79
|
+
|
80
|
+
</div>
|
81
|
+
</nav>
|
82
|
+
|
83
|
+
<main role="main" aria-labelledby="class-WWWJDic::Utils::Downloader::Downloader">
|
84
|
+
<h1 id="class-WWWJDic::Utils::Downloader::Downloader" class="class">
|
85
|
+
class WWWJDic::Utils::Downloader::Downloader
|
86
|
+
</h1>
|
87
|
+
|
88
|
+
<section class="description">
|
89
|
+
|
90
|
+
<p>!/usr/bin/env ruby</p>
|
91
|
+
|
92
|
+
<pre>An HTTP/HTTPS/FTP file downloader library/CLI based upon
|
93
|
+
MiniPortile's HTTP implementation.
|
94
|
+
|
95
|
+
Author:: Jon Maken
|
96
|
+
License:: 3-clause BSD
|
97
|
+
Revision:: 2012-03-25 23:01:19 -0600</pre>
|
98
|
+
|
99
|
+
</section>
|
100
|
+
|
101
|
+
|
102
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<section class="constants-list">
|
109
|
+
<header>
|
110
|
+
<h3>Constants</h3>
|
111
|
+
</header>
|
112
|
+
<dl>
|
113
|
+
|
114
|
+
<dt id="VERSION">VERSION
|
115
|
+
|
116
|
+
<dd>
|
117
|
+
|
118
|
+
|
119
|
+
</dl>
|
120
|
+
</section>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<section class="attribute-method-details" class="method-section">
|
125
|
+
<header>
|
126
|
+
<h3>Attributes</h3>
|
127
|
+
</header>
|
128
|
+
|
129
|
+
|
130
|
+
<div id="attribute-c-ftp_data_chunk_size" class="method-detail">
|
131
|
+
<div class="method-heading attribute-method-heading">
|
132
|
+
<span class="method-name">ftp_data_chunk_size</span><span
|
133
|
+
class="attribute-access-type">[RW]</span>
|
134
|
+
</div>
|
135
|
+
|
136
|
+
<div class="method-description">
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<div id="attribute-c-logger" class="method-detail">
|
144
|
+
<div class="method-heading attribute-method-heading">
|
145
|
+
<span class="method-name">logger</span><span
|
146
|
+
class="attribute-access-type">[RW]</span>
|
147
|
+
</div>
|
148
|
+
|
149
|
+
<div class="method-description">
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
<div id="attribute-c-max_ca_verify_depth" class="method-detail">
|
157
|
+
<div class="method-heading attribute-method-heading">
|
158
|
+
<span class="method-name">max_ca_verify_depth</span><span
|
159
|
+
class="attribute-access-type">[RW]</span>
|
160
|
+
</div>
|
161
|
+
|
162
|
+
<div class="method-description">
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
</div>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
</section>
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
174
|
+
<header>
|
175
|
+
<h3>Public Class Methods</h3>
|
176
|
+
</header>
|
177
|
+
|
178
|
+
|
179
|
+
<div id="method-c-download_file" class="method-detail ">
|
180
|
+
|
181
|
+
<div class="method-heading">
|
182
|
+
<span class="method-name">download_file</span><span
|
183
|
+
class="method-args">(url, full_path, count = 3)</span>
|
184
|
+
|
185
|
+
<span class="method-click-advice">click to toggle source</span>
|
186
|
+
|
187
|
+
</div>
|
188
|
+
|
189
|
+
|
190
|
+
<div class="method-description">
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
<div class="method-source-code" id="download_file-source">
|
198
|
+
<pre> <span class="ruby-comment"># File lib/wwwjdic/utils/downloader.rb</span>
|
199
|
+
<span class="line-num">59</span> <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">download_file</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">full_path</span>, <span class="ruby-identifier">count</span> = <span class="ruby-value">3</span>)
|
200
|
+
<span class="line-num">60</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">RuntimeError</span>, <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">t</span>(<span class="ruby-string">'error.nil'</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">url</span>.<span class="ruby-identifier">nil?</span>
|
201
|
+
<span class="line-num">61</span> <span class="ruby-comment"># return if File.exist?(full_path)</span>
|
202
|
+
<span class="line-num">62</span>
|
203
|
+
<span class="line-num">63</span> <span class="ruby-identifier">http_download</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">full_path</span>, <span class="ruby-identifier">count</span>)
|
204
|
+
<span class="line-num">64</span> <span class="ruby-keyword">end</span></pre>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
</div>
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
</div>
|
213
|
+
|
214
|
+
|
215
|
+
</section>
|
216
|
+
|
217
|
+
</section>
|
218
|
+
|
219
|
+
</main>
|
220
|
+
|
221
|
+
|
222
|
+
<footer id="validator-badges" role="contentinfo">
|
223
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
224
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.1.1.
|
225
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
226
|
+
</footer>
|
227
|
+
|