metric_tools 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -6
- data/doc/AWS.html +150 -0
- data/doc/{Pref/Skype.html → AWS/S3.html} +19 -25
- data/doc/Gemfile.html +16 -8
- data/doc/MetricTools.html +21 -9
- data/doc/MetricTools/IndexTree.html +197 -20
- data/doc/MetricTools/S3.html +47 -21
- data/doc/MetricTools/SpreadSheet.html +139 -22
- data/doc/MetricTools/Table.html +210 -48
- data/doc/Object.html +16 -27
- data/doc/Pref.html +18 -7
- data/doc/Pref/GoogleDocs.html +17 -7
- data/doc/Pref/S3.html +17 -7
- data/doc/README_md.html +170 -0
- data/doc/created.rid +24 -13
- data/doc/doc/created_rid.html +111 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/index.html +15 -7
- data/doc/js/darkfish.js +9 -7
- data/doc/js/search_index.js +1 -1
- data/doc/metric_tools_gemspec.html +132 -0
- data/doc/rdoc.css +52 -0
- data/doc/table_of_contents.html +48 -22
- data/metric_tools.gemspec +1 -2
- metadata +7 -21
- data/doc/MetricTools/Skype.html +0 -343
- data/lib/metric_tools/skype.rb +0 -68
- data/spec/skype_spec.rb +0 -39
@@ -43,6 +43,8 @@
|
|
43
43
|
</nav>
|
44
44
|
|
45
45
|
|
46
|
+
|
47
|
+
|
46
48
|
<div id="file-metadata">
|
47
49
|
<nav id="file-list-section" class="section">
|
48
50
|
<h3 class="section-header">Defined In</h3>
|
@@ -64,19 +66,28 @@
|
|
64
66
|
</nav>
|
65
67
|
|
66
68
|
|
69
|
+
|
67
70
|
<!-- Method Quickref -->
|
68
71
|
<nav id="method-list-section" class="section">
|
69
72
|
<h3 class="section-header">Methods</h3>
|
70
73
|
|
71
74
|
<ul class="link-list">
|
72
75
|
|
73
|
-
<li><a href="#method-c-new">::new</a>
|
76
|
+
<li ><a href="#method-c-new">::new</a>
|
77
|
+
|
78
|
+
<li ><a href="#method-i-5B-5D">#[]</a>
|
79
|
+
|
80
|
+
<li ><a href="#method-i-5B-5D-3D">#[]=</a>
|
74
81
|
|
75
|
-
<li><a href="#method-i-
|
82
|
+
<li ><a href="#method-i-build_with_hash">#build_with_hash</a>
|
76
83
|
|
77
|
-
<li><a href="#method-i-
|
84
|
+
<li ><a href="#method-i-build_with_json">#build_with_json</a>
|
78
85
|
|
79
|
-
<li><a href="#method-i-
|
86
|
+
<li ><a href="#method-i-clear">#clear</a>
|
87
|
+
|
88
|
+
<li ><a href="#method-i-to_json">#to_json</a>
|
89
|
+
|
90
|
+
<li ><a href="#method-i-to_s">#to_s</a>
|
80
91
|
|
81
92
|
</ul>
|
82
93
|
</nav>
|
@@ -91,8 +102,14 @@
|
|
91
102
|
|
92
103
|
<li class="file"><a href="../Gemfile.html">Gemfile</a>
|
93
104
|
|
105
|
+
<li class="file"><a href="../README_md.html">README</a>
|
106
|
+
|
94
107
|
<li class="file"><a href="../config/my_pref.html">my_pref</a>
|
95
108
|
|
109
|
+
<li class="file"><a href="../doc/created_rid.html">created.rid</a>
|
110
|
+
|
111
|
+
<li class="file"><a href="../metric_tools_gemspec.html">metric_tools.gemspec</a>
|
112
|
+
|
96
113
|
</ul>
|
97
114
|
</nav>
|
98
115
|
|
@@ -101,28 +118,28 @@
|
|
101
118
|
|
102
119
|
<ul class="link-list">
|
103
120
|
|
121
|
+
<li><a href="../AWS.html">AWS</a>
|
122
|
+
|
123
|
+
<li><a href="../AWS/S3.html">AWS::S3</a>
|
124
|
+
|
104
125
|
<li><a href="../MetricTools.html">MetricTools</a>
|
105
126
|
|
106
127
|
<li><a href="../MetricTools/IndexTree.html">MetricTools::IndexTree</a>
|
107
128
|
|
108
129
|
<li><a href="../MetricTools/S3.html">MetricTools::S3</a>
|
109
130
|
|
110
|
-
<li><a href="../MetricTools/Skype.html">MetricTools::Skype</a>
|
111
|
-
|
112
131
|
<li><a href="../MetricTools/SpreadSheet.html">MetricTools::SpreadSheet</a>
|
113
132
|
|
114
133
|
<li><a href="../MetricTools/Table.html">MetricTools::Table</a>
|
115
134
|
|
135
|
+
<li><a href="../Object.html">Object</a>
|
136
|
+
|
116
137
|
<li><a href="../Pref.html">Pref</a>
|
117
138
|
|
118
139
|
<li><a href="../Pref/GoogleDocs.html">Pref::GoogleDocs</a>
|
119
140
|
|
120
141
|
<li><a href="../Pref/S3.html">Pref::S3</a>
|
121
142
|
|
122
|
-
<li><a href="../Pref/Skype.html">Pref::Skype</a>
|
123
|
-
|
124
|
-
<li><a href="../Object.html">Object</a>
|
125
|
-
|
126
143
|
</ul>
|
127
144
|
</nav>
|
128
145
|
|
@@ -160,8 +177,10 @@
|
|
160
177
|
|
161
178
|
<div class="method-heading">
|
162
179
|
<span class="method-name">new</span><span
|
163
|
-
class="method-args">()</span>
|
180
|
+
class="method-args">(hash_or_json=nil)</span>
|
181
|
+
|
164
182
|
<span class="method-click-advice">click to toggle source</span>
|
183
|
+
|
165
184
|
</div>
|
166
185
|
|
167
186
|
|
@@ -169,12 +188,19 @@
|
|
169
188
|
|
170
189
|
|
171
190
|
|
191
|
+
|
172
192
|
|
173
193
|
|
174
194
|
<div class="method-source-code" id="new-source">
|
175
|
-
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line
|
176
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
|
177
|
-
<span class="ruby-
|
195
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line 10</span>
|
196
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">hash_or_json</span>=<span class="ruby-keyword">nil</span>)
|
197
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">hash_or_json</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Hash</span>
|
198
|
+
<span class="ruby-identifier">build_with_hash</span>(<span class="ruby-identifier">hash_or_json</span>)
|
199
|
+
<span class="ruby-keyword">elsif</span> <span class="ruby-identifier">hash_or_json</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">String</span>
|
200
|
+
<span class="ruby-identifier">build_with_json</span>(<span class="ruby-identifier">hash_or_json</span>)
|
201
|
+
<span class="ruby-keyword">else</span>
|
202
|
+
<span class="ruby-ivar">@_hash</span> = {}
|
203
|
+
<span class="ruby-keyword">end</span>
|
178
204
|
<span class="ruby-keyword">end</span></pre>
|
179
205
|
</div><!-- new-source -->
|
180
206
|
|
@@ -197,7 +223,9 @@
|
|
197
223
|
<div class="method-heading">
|
198
224
|
<span class="method-name">[]</span><span
|
199
225
|
class="method-args">(*args)</span>
|
226
|
+
|
200
227
|
<span class="method-click-advice">click to toggle source</span>
|
228
|
+
|
201
229
|
</div>
|
202
230
|
|
203
231
|
|
@@ -205,11 +233,12 @@
|
|
205
233
|
|
206
234
|
|
207
235
|
|
236
|
+
|
208
237
|
|
209
238
|
|
210
239
|
<div class="method-source-code" id="5B-5D-source">
|
211
|
-
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line
|
212
|
-
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(
|
240
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line 21</span>
|
241
|
+
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
213
242
|
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword">nil</span>
|
214
243
|
<span class="ruby-identifier">process_tracing_keys</span>(<span class="ruby-ivar">@_hash</span>, <span class="ruby-identifier">args</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">obj</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">is_leaf</span><span class="ruby-operator">|</span>
|
215
244
|
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">obj</span>[<span class="ruby-identifier">key</span>] <span class="ruby-keyword">if</span> <span class="ruby-identifier">is_leaf</span>
|
@@ -231,7 +260,9 @@
|
|
231
260
|
<div class="method-heading">
|
232
261
|
<span class="method-name">[]=</span><span
|
233
262
|
class="method-args">(*args)</span>
|
263
|
+
|
234
264
|
<span class="method-click-advice">click to toggle source</span>
|
265
|
+
|
235
266
|
</div>
|
236
267
|
|
237
268
|
|
@@ -239,11 +270,12 @@
|
|
239
270
|
|
240
271
|
|
241
272
|
|
273
|
+
|
242
274
|
|
243
275
|
|
244
276
|
<div class="method-source-code" id="5B-5D-3D-source">
|
245
|
-
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line
|
246
|
-
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]=</span>(
|
277
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line 29</span>
|
278
|
+
<span class="ruby-keyword">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
247
279
|
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">args</span>.<span class="ruby-identifier">pop</span>
|
248
280
|
<span class="ruby-identifier">process_tracing_keys</span>(<span class="ruby-ivar">@_hash</span>, <span class="ruby-identifier">args</span>) {<span class="ruby-operator">|</span><span class="ruby-identifier">obj</span>, <span class="ruby-identifier">key</span>, <span class="ruby-identifier">is_leaf</span><span class="ruby-operator">|</span>
|
249
281
|
<span class="ruby-keyword">if</span> <span class="ruby-identifier">is_leaf</span>
|
@@ -263,12 +295,84 @@
|
|
263
295
|
</div><!-- 5B-5D-3D-method -->
|
264
296
|
|
265
297
|
|
298
|
+
<div id="method-i-clear" class="method-detail ">
|
299
|
+
|
300
|
+
<div class="method-heading">
|
301
|
+
<span class="method-name">clear</span><span
|
302
|
+
class="method-args">()</span>
|
303
|
+
|
304
|
+
<span class="method-click-advice">click to toggle source</span>
|
305
|
+
|
306
|
+
</div>
|
307
|
+
|
308
|
+
|
309
|
+
<div class="method-description">
|
310
|
+
|
311
|
+
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
<div class="method-source-code" id="clear-source">
|
317
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line 40</span>
|
318
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">clear</span>
|
319
|
+
<span class="ruby-ivar">@_hash</span> = {}
|
320
|
+
<span class="ruby-keyword">end</span></pre>
|
321
|
+
</div><!-- clear-source -->
|
322
|
+
|
323
|
+
</div>
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
</div><!-- clear-method -->
|
329
|
+
|
330
|
+
|
331
|
+
<div id="method-i-to_json" class="method-detail ">
|
332
|
+
|
333
|
+
<div class="method-heading">
|
334
|
+
<span class="method-name">to_json</span><span
|
335
|
+
class="method-args">(option={})</span>
|
336
|
+
|
337
|
+
<span class="method-click-advice">click to toggle source</span>
|
338
|
+
|
339
|
+
</div>
|
340
|
+
|
341
|
+
|
342
|
+
<div class="method-description">
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
<div class="method-source-code" id="to_json-source">
|
350
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line 48</span>
|
351
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_json</span>(<span class="ruby-identifier">option</span>={})
|
352
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">option</span>[<span class="ruby-value">:pretty</span>]
|
353
|
+
<span class="ruby-constant">JSON</span>.<span class="ruby-identifier">pretty_generate</span>(<span class="ruby-ivar">@_hash</span>)
|
354
|
+
<span class="ruby-keyword">else</span>
|
355
|
+
<span class="ruby-constant">JSON</span>.<span class="ruby-identifier">generate</span>(<span class="ruby-ivar">@_hash</span>)
|
356
|
+
<span class="ruby-keyword">end</span>
|
357
|
+
<span class="ruby-keyword">end</span></pre>
|
358
|
+
</div><!-- to_json-source -->
|
359
|
+
|
360
|
+
</div>
|
361
|
+
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
</div><!-- to_json-method -->
|
366
|
+
|
367
|
+
|
266
368
|
<div id="method-i-to_s" class="method-detail ">
|
267
369
|
|
268
370
|
<div class="method-heading">
|
269
371
|
<span class="method-name">to_s</span><span
|
270
372
|
class="method-args">()</span>
|
373
|
+
|
271
374
|
<span class="method-click-advice">click to toggle source</span>
|
375
|
+
|
272
376
|
</div>
|
273
377
|
|
274
378
|
|
@@ -276,10 +380,11 @@
|
|
276
380
|
|
277
381
|
|
278
382
|
|
383
|
+
|
279
384
|
|
280
385
|
|
281
386
|
<div class="method-source-code" id="to_s-source">
|
282
|
-
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line
|
387
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line 44</span>
|
283
388
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
|
284
389
|
<span class="ruby-ivar">@_hash</span>.<span class="ruby-identifier">to_s</span>
|
285
390
|
<span class="ruby-keyword">end</span></pre>
|
@@ -295,6 +400,78 @@
|
|
295
400
|
|
296
401
|
</section><!-- public-instance-method-details -->
|
297
402
|
|
403
|
+
<section id="protected-instance-5Buntitled-5D-method-details" class="method-section section">
|
404
|
+
<h3 class="section-header">Protected Instance Methods</h3>
|
405
|
+
|
406
|
+
|
407
|
+
<div id="method-i-build_with_hash" class="method-detail ">
|
408
|
+
|
409
|
+
<div class="method-heading">
|
410
|
+
<span class="method-name">build_with_hash</span><span
|
411
|
+
class="method-args">(hash)</span>
|
412
|
+
|
413
|
+
<span class="method-click-advice">click to toggle source</span>
|
414
|
+
|
415
|
+
</div>
|
416
|
+
|
417
|
+
|
418
|
+
<div class="method-description">
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
|
424
|
+
|
425
|
+
<div class="method-source-code" id="build_with_hash-source">
|
426
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line 57</span>
|
427
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">build_with_hash</span>(<span class="ruby-identifier">hash</span>)
|
428
|
+
<span class="ruby-ivar">@_hash</span> = <span class="ruby-identifier">hash</span>
|
429
|
+
<span class="ruby-keyword">end</span></pre>
|
430
|
+
</div><!-- build_with_hash-source -->
|
431
|
+
|
432
|
+
</div>
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
</div><!-- build_with_hash-method -->
|
438
|
+
|
439
|
+
|
440
|
+
<div id="method-i-build_with_json" class="method-detail ">
|
441
|
+
|
442
|
+
<div class="method-heading">
|
443
|
+
<span class="method-name">build_with_json</span><span
|
444
|
+
class="method-args">(json)</span>
|
445
|
+
|
446
|
+
<span class="method-click-advice">click to toggle source</span>
|
447
|
+
|
448
|
+
</div>
|
449
|
+
|
450
|
+
|
451
|
+
<div class="method-description">
|
452
|
+
|
453
|
+
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
<div class="method-source-code" id="build_with_json-source">
|
459
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/index_tree.rb, line 61</span>
|
460
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">build_with_json</span>(<span class="ruby-identifier">json</span>)
|
461
|
+
<span class="ruby-ivar">@_hash</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">json</span>)
|
462
|
+
<span class="ruby-keyword">end</span></pre>
|
463
|
+
</div><!-- build_with_json-source -->
|
464
|
+
|
465
|
+
</div>
|
466
|
+
|
467
|
+
|
468
|
+
|
469
|
+
|
470
|
+
</div><!-- build_with_json-method -->
|
471
|
+
|
472
|
+
|
473
|
+
</section><!-- protected-instance-method-details -->
|
474
|
+
|
298
475
|
</section><!-- 5Buntitled-5D -->
|
299
476
|
|
300
477
|
</div><!-- documentation -->
|
@@ -302,7 +479,7 @@
|
|
302
479
|
|
303
480
|
<footer id="validator-badges">
|
304
481
|
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
305
|
-
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a>
|
482
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
|
306
483
|
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
307
484
|
</footer>
|
308
485
|
|
data/doc/MetricTools/S3.html
CHANGED
@@ -43,6 +43,8 @@
|
|
43
43
|
</nav>
|
44
44
|
|
45
45
|
|
46
|
+
|
47
|
+
|
46
48
|
<div id="file-metadata">
|
47
49
|
<nav id="file-list-section" class="section">
|
48
50
|
<h3 class="section-header">Defined In</h3>
|
@@ -64,19 +66,20 @@
|
|
64
66
|
</nav>
|
65
67
|
|
66
68
|
|
69
|
+
|
67
70
|
<!-- Method Quickref -->
|
68
71
|
<nav id="method-list-section" class="section">
|
69
72
|
<h3 class="section-header">Methods</h3>
|
70
73
|
|
71
74
|
<ul class="link-list">
|
72
75
|
|
73
|
-
<li><a href="#method-c-download">::download</a>
|
76
|
+
<li ><a href="#method-c-download">::download</a>
|
74
77
|
|
75
|
-
<li><a href="#method-c-fetch_all">::fetch_all</a>
|
78
|
+
<li ><a href="#method-c-fetch_all">::fetch_all</a>
|
76
79
|
|
77
|
-
<li><a href="#method-c-login">::login</a>
|
80
|
+
<li ><a href="#method-c-login">::login</a>
|
78
81
|
|
79
|
-
<li><a href="#method-c-login-3F">::login?</a>
|
82
|
+
<li ><a href="#method-c-login-3F">::login?</a>
|
80
83
|
|
81
84
|
</ul>
|
82
85
|
</nav>
|
@@ -91,8 +94,14 @@
|
|
91
94
|
|
92
95
|
<li class="file"><a href="../Gemfile.html">Gemfile</a>
|
93
96
|
|
97
|
+
<li class="file"><a href="../README_md.html">README</a>
|
98
|
+
|
94
99
|
<li class="file"><a href="../config/my_pref.html">my_pref</a>
|
95
100
|
|
101
|
+
<li class="file"><a href="../doc/created_rid.html">created.rid</a>
|
102
|
+
|
103
|
+
<li class="file"><a href="../metric_tools_gemspec.html">metric_tools.gemspec</a>
|
104
|
+
|
96
105
|
</ul>
|
97
106
|
</nav>
|
98
107
|
|
@@ -101,28 +110,28 @@
|
|
101
110
|
|
102
111
|
<ul class="link-list">
|
103
112
|
|
113
|
+
<li><a href="../AWS.html">AWS</a>
|
114
|
+
|
115
|
+
<li><a href="../AWS/S3.html">AWS::S3</a>
|
116
|
+
|
104
117
|
<li><a href="../MetricTools.html">MetricTools</a>
|
105
118
|
|
106
119
|
<li><a href="../MetricTools/IndexTree.html">MetricTools::IndexTree</a>
|
107
120
|
|
108
121
|
<li><a href="../MetricTools/S3.html">MetricTools::S3</a>
|
109
122
|
|
110
|
-
<li><a href="../MetricTools/Skype.html">MetricTools::Skype</a>
|
111
|
-
|
112
123
|
<li><a href="../MetricTools/SpreadSheet.html">MetricTools::SpreadSheet</a>
|
113
124
|
|
114
125
|
<li><a href="../MetricTools/Table.html">MetricTools::Table</a>
|
115
126
|
|
127
|
+
<li><a href="../Object.html">Object</a>
|
128
|
+
|
116
129
|
<li><a href="../Pref.html">Pref</a>
|
117
130
|
|
118
131
|
<li><a href="../Pref/GoogleDocs.html">Pref::GoogleDocs</a>
|
119
132
|
|
120
133
|
<li><a href="../Pref/S3.html">Pref::S3</a>
|
121
134
|
|
122
|
-
<li><a href="../Pref/Skype.html">Pref::Skype</a>
|
123
|
-
|
124
|
-
<li><a href="../Object.html">Object</a>
|
125
|
-
|
126
135
|
</ul>
|
127
136
|
</nav>
|
128
137
|
|
@@ -161,7 +170,9 @@
|
|
161
170
|
<div class="method-heading">
|
162
171
|
<span class="method-name">download</span><span
|
163
172
|
class="method-args">(file_key, target_dir, hierarchy=false)</span>
|
173
|
+
|
164
174
|
<span class="method-click-advice">click to toggle source</span>
|
175
|
+
|
165
176
|
</div>
|
166
177
|
|
167
178
|
|
@@ -170,10 +181,11 @@
|
|
170
181
|
<p>file_keyを指定してファイルをダウンロードします。 target_dirが存在しない場合は、勝手に作成します。
|
171
182
|
hierarchy=trueにすると、S3上のディレクトリ構造を保持してDownloadします。</p>
|
172
183
|
|
184
|
+
|
173
185
|
|
174
186
|
|
175
187
|
<div class="method-source-code" id="download-source">
|
176
|
-
<pre><span class="ruby-comment"># File lib/metric_tools/s3.rb, line
|
188
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/s3.rb, line 44</span>
|
177
189
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">download</span>(<span class="ruby-identifier">file_key</span>, <span class="ruby-identifier">target_dir</span>, <span class="ruby-identifier">hierarchy</span>=<span class="ruby-keyword">false</span>)
|
178
190
|
<span class="ruby-identifier">file_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">target_dir</span>, <span class="ruby-identifier">hierarchy</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">file_key</span> <span class="ruby-operator">:</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">file_key</span>))
|
179
191
|
<span class="ruby-identifier">mkdir_for_file</span>(<span class="ruby-identifier">file_path</span>)
|
@@ -200,7 +212,9 @@ hierarchy=trueにすると、S3上のディレクトリ構造を保持してDown
|
|
200
212
|
<div class="method-heading">
|
201
213
|
<span class="method-name">fetch_all</span><span
|
202
214
|
class="method-args">(dir_key, target_dir, force_all=false, &condition)</span>
|
215
|
+
|
203
216
|
<span class="method-click-advice">click to toggle source</span>
|
217
|
+
|
204
218
|
</div>
|
205
219
|
|
206
220
|
|
@@ -209,23 +223,27 @@ hierarchy=trueにすると、S3上のディレクトリ構造を保持してDown
|
|
209
223
|
<p>指定されたdir_key以下のファイル/ディレクトリをすべてDLします。
|
210
224
|
force_all=falseにすると、既にローカルにファイルが有る場合はDLしません。</p>
|
211
225
|
|
226
|
+
|
212
227
|
|
213
228
|
|
214
229
|
<div class="method-source-code" id="fetch_all-source">
|
215
|
-
<pre><span class="ruby-comment"># File lib/metric_tools/s3.rb, line
|
216
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch_all</span>(<span class="ruby-identifier">dir_key</span>, <span class="ruby-identifier">target_dir</span>, <span class="ruby-identifier">force_all</span>=<span class="ruby-keyword">false</span>,
|
217
|
-
<span class="ruby-identifier">
|
230
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/s3.rb, line 60</span>
|
231
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">fetch_all</span>(<span class="ruby-identifier">dir_key</span>, <span class="ruby-identifier">target_dir</span>, <span class="ruby-identifier">force_all</span>=<span class="ruby-keyword">false</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">condition</span>)
|
232
|
+
<span class="ruby-identifier">objects_in_dir</span> = <span class="ruby-ivar">@bucket</span>.<span class="ruby-identifier">objects</span>(<span class="ruby-identifier">prefix</span><span class="ruby-operator">:</span> <span class="ruby-identifier">dir_key</span>)
|
233
|
+
<span class="ruby-identifier">remote_files</span> = <span class="ruby-identifier">objects_in_dir</span>
|
218
234
|
.<span class="ruby-identifier">select</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span>
|
219
235
|
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">key</span>
|
220
236
|
<span class="ruby-identifier">is_dir</span> = (<span class="ruby-identifier">key</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">'/'</span>)
|
221
|
-
<span class="ruby-identifier">name</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">dir_key</span>
|
222
237
|
<span class="ruby-identifier">cond</span> = <span class="ruby-identifier">condition</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">?</span> <span class="ruby-keyword">true</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">condition</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">obj</span>)
|
223
|
-
<span class="ruby-operator">!</span><span class="ruby-identifier">is_dir</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">
|
238
|
+
<span class="ruby-operator">!</span><span class="ruby-identifier">is_dir</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">cond</span> }
|
224
239
|
.<span class="ruby-identifier">collect</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">obj</span><span class="ruby-operator">|</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">key</span> }
|
225
|
-
<span class="ruby-
|
240
|
+
<span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-identifier">target_dir</span>)
|
241
|
+
<span class="ruby-identifier">local_files</span> = <span class="ruby-constant">Dir</span>[<span class="ruby-string">"**/*"</span>]
|
242
|
+
|
243
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"remote directory is empty => #{@bucket.name}/#{dir_key}"</span> <span class="ruby-keyword">if</span> (<span class="ruby-identifier">remote_files</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">remote_files</span>.<span class="ruby-identifier">empty?</span>)
|
226
244
|
|
227
245
|
<span class="ruby-identifier">remote_files</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
228
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">force_all</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">local_files</span>.<span class="ruby-identifier">
|
246
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">force_all</span> <span class="ruby-operator">||</span> <span class="ruby-operator">!</span><span class="ruby-identifier">local_files</span>.<span class="ruby-identifier">any?</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">f</span>) <span class="ruby-operator">==</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">key</span>)}
|
229
247
|
<span class="ruby-identifier">download</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">target_dir</span>, <span class="ruby-keyword">true</span>)
|
230
248
|
<span class="ruby-keyword">end</span>
|
231
249
|
}
|
@@ -246,7 +264,9 @@ force_all=falseにすると、既にローカルにファイルが有る場合
|
|
246
264
|
<div class="method-heading">
|
247
265
|
<span class="method-name">login</span><span
|
248
266
|
class="method-args">(key, secret, bucket_name)</span>
|
267
|
+
|
249
268
|
<span class="method-click-advice">click to toggle source</span>
|
269
|
+
|
250
270
|
</div>
|
251
271
|
|
252
272
|
|
@@ -254,6 +274,7 @@ force_all=falseにすると、既にローカルにファイルが有る場合
|
|
254
274
|
|
255
275
|
<p>access_key, secret_key, bucket_nameを指定してログインします。</p>
|
256
276
|
|
277
|
+
|
257
278
|
|
258
279
|
|
259
280
|
<div class="method-source-code" id="login-source">
|
@@ -263,6 +284,8 @@ force_all=falseにすると、既にローカルにファイルが有る場合
|
|
263
284
|
<span class="ruby-ivar">@secret</span> = <span class="ruby-identifier">secret</span>
|
264
285
|
<span class="ruby-ivar">@bucket_name</span> = <span class="ruby-identifier">bucket_name</span>
|
265
286
|
|
287
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Login to #{bucket_name} .."</span>
|
288
|
+
|
266
289
|
<span class="ruby-constant">AWS</span><span class="ruby-operator">::</span><span class="ruby-constant">S3</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">establish_connection!</span>(
|
267
290
|
<span class="ruby-value">:access_key_id</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">key</span>,
|
268
291
|
<span class="ruby-value">:secret_access_key</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">secret</span>,
|
@@ -285,7 +308,9 @@ force_all=falseにすると、既にローカルにファイルが有る場合
|
|
285
308
|
<div class="method-heading">
|
286
309
|
<span class="method-name">login?</span><span
|
287
310
|
class="method-args">()</span>
|
311
|
+
|
288
312
|
<span class="method-click-advice">click to toggle source</span>
|
313
|
+
|
289
314
|
</div>
|
290
315
|
|
291
316
|
|
@@ -293,12 +318,13 @@ force_all=falseにすると、既にローカルにファイルが有る場合
|
|
293
318
|
|
294
319
|
<p>loginしているかどうかを返します</p>
|
295
320
|
|
321
|
+
|
296
322
|
|
297
323
|
|
298
324
|
<div class="method-source-code" id="login-3F-source">
|
299
|
-
<pre><span class="ruby-comment"># File lib/metric_tools/s3.rb, line
|
325
|
+
<pre><span class="ruby-comment"># File lib/metric_tools/s3.rb, line 35</span>
|
300
326
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">login?</span>
|
301
|
-
<span class="ruby-keyword">return</span> <span class="ruby-operator">!</span><span class="ruby-
|
327
|
+
<span class="ruby-keyword">return</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@bucket</span>.<span class="ruby-identifier">nil?</span>
|
302
328
|
<span class="ruby-keyword">end</span></pre>
|
303
329
|
</div><!-- login-3F-source -->
|
304
330
|
|
@@ -319,7 +345,7 @@ force_all=falseにすると、既にローカルにファイルが有る場合
|
|
319
345
|
|
320
346
|
<footer id="validator-badges">
|
321
347
|
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
322
|
-
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a>
|
348
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
|
323
349
|
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
324
350
|
</footer>
|
325
351
|
|