hakto 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ Hakto Safe SDBM Wrapper Changelog
2
+ =================================
3
+
4
+ ## Ver 0.1.0
5
+
6
+ - 2012/12/08
7
+ - Added SafeSDBM#csv_each method.
8
+
9
+ ## Ver 0.0.1
10
+
11
+ - 2012/12/07
12
+ - First release
@@ -0,0 +1,12 @@
1
+ Hakto Safe SDBM Wrapper 更新履歴
2
+ ================================
3
+
4
+ ## Ver 0.1.0
5
+
6
+ - 2012/12/08
7
+ - SafeSDBM#csv_eachメソッドを追加。
8
+
9
+ ## Ver 0.0.1
10
+
11
+ - 2012/12/07
12
+ - ファーストリリース。
data/README.md CHANGED
@@ -34,7 +34,7 @@ Hakto enables to tighten up a code that uses SDBM library like following codes.
34
34
 
35
35
  class Klass
36
36
  def initialize(db_path)
37
- @sdb = SafeSDBM.new(db_path)
37
+ @sdb = Hakto::SafeSDBM.new(db_path)
38
38
  end
39
39
 
40
40
  def method1
@@ -78,12 +78,20 @@ Download hakto-x.y.z.gem, then execute following command to install Hakto.
78
78
 
79
79
  `$ sudo gem install hakto-x.y.z.gem`
80
80
 
81
+ On the other hand, you can install from RubyGems.org to use following command.
82
+
83
+ `$ sudo gem install hakto`
84
+
81
85
  Also you can install Hakto without gem. Allocate the safe_sdbm.rb where is ruby interpreter can load Hakto.
82
86
 
83
87
  ## Sample code
84
88
 
85
89
  See tb_safe_sdbm.rb file. It is an unit test code, and it doubles with sample code.
86
90
 
91
+ ## API document
92
+
93
+ See following website: [http://quellencode.org/hakto-doc/](http://quellencode.org/hakto-doc/ "")
94
+
87
95
  ## About Author
88
96
 
89
97
  Moza USANE
@@ -34,7 +34,7 @@ SDBMライブラリを使うときにありがちな、以下の様な煩雑な
34
34
 
35
35
  class Klass
36
36
  def initialize(db_path)
37
- @sdb = SafeSDBM.new(db_path)
37
+ @sdb = Hakto::SafeSDBM.new(db_path)
38
38
  end
39
39
 
40
40
  def method1
@@ -76,7 +76,9 @@ hakto-x.y.z.gemファイル(x、y、zはバージョン番号)をダウン
76
76
 
77
77
  `$ sudo gem install hakto-x.y.z.gem`
78
78
 
79
- または、
79
+ または、RubyGems.orgからgemコマンドを使ってインストールすることもできる。
80
+
81
+ `$ sudo gem install hakto`
80
82
 
81
83
  gemを使わない場合は、Rubyのパスが通っている適当な場所にsafe_sdbm.rbを置く。
82
84
 
@@ -84,6 +86,9 @@ gemを使わない場合は、Rubyのパスが通っている適当な場所にs
84
86
 
85
87
  tb_safe_sdbm.rbがサンプルコードを兼ねている。
86
88
 
89
+ ## APIドキュメント
90
+
91
+ [http://quellencode.org/hakto-doc/](http://quellencode.org/hakto-doc/ "")を参照
87
92
 
88
93
  ## 作者について
89
94
 
data/Rakefile CHANGED
@@ -4,7 +4,7 @@ spec = Gem::Specification.new do |s|
4
4
  s.name = "hakto"
5
5
  s.summary = "Hakto Safe SDBM Wrapper is a safe wrapper of SDBM class."
6
6
  s.description = File.read(File.join(File.dirname(__FILE__), "README.md"))
7
- s.version = "0.0.1"
7
+ s.version = "0.1.0"
8
8
  s.author = "Moza USANE"
9
9
  s.email = "mozamimy@quellencode.org"
10
10
  s.homepage = "http://blog.quellencode.org/"
@@ -67,6 +67,8 @@
67
67
 
68
68
  <ul>
69
69
 
70
+ <li class="file"><a href="./LICENSE.html">LICENSE</a>
71
+
70
72
  <li class="file"><a href="./Rakefile.html">Rakefile</a>
71
73
 
72
74
  </ul>
@@ -107,7 +109,7 @@ href="mailto:mozamimy@quellencode.org">mozamimy@quellencode.org</a>)</p>
107
109
  <p>Copyright © 2012 Moza USANE</p>
108
110
  </dd><dt>License
109
111
  <dd>
110
- <p>MIT License (see the LICENSE file)</p>
112
+ <p>MIT License (see the <a href="LICENSE.html">LICENSE</a> file)</p>
111
113
  </dd></dl>
112
114
 
113
115
  </div><!-- description -->
@@ -72,6 +72,8 @@
72
72
 
73
73
  <li><a href="#method-c-new">::new</a>
74
74
 
75
+ <li><a href="#method-i-csv_each">#csv_each</a>
76
+
75
77
  <li><a href="#method-i-print_each">#print_each</a>
76
78
 
77
79
  <li><a href="#method-i-print_keys">#print_keys</a>
@@ -89,6 +91,8 @@
89
91
 
90
92
  <ul>
91
93
 
94
+ <li class="file"><a href="../LICENSE.html">LICENSE</a>
95
+
92
96
  <li class="file"><a href="../Rakefile.html">Rakefile</a>
93
97
 
94
98
  </ul>
@@ -203,6 +207,42 @@ use almost instance methods of SDBM class.</p>
203
207
  <h3 class="section-header">Public Instance Methods</h3>
204
208
 
205
209
 
210
+ <div id="method-i-csv_each" class="method-detail ">
211
+
212
+ <div class="method-heading">
213
+ <span class="method-name">csv_each</span><span
214
+ class="method-args">()</span>
215
+ <span class="method-click-advice">click to toggle source</span>
216
+ </div>
217
+
218
+
219
+ <div class="method-description">
220
+
221
+ <p>Return key-value pair with CSV format.</p>
222
+
223
+
224
+
225
+ <div class="method-source-code" id="csv_each-source">
226
+ <pre><span class="ruby-comment"># File lib/hakto/safe_sdbm.rb, line 55</span>
227
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">csv_each</span>
228
+ <span class="ruby-identifier">operate</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">dbm</span><span class="ruby-operator">|</span>
229
+ <span class="ruby-identifier">ret_string</span> = <span class="ruby-string">&quot;&quot;</span>
230
+ <span class="ruby-identifier">dbm</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
231
+ <span class="ruby-identifier">ret_string</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;#{key},#{value}\r\n&quot;</span>
232
+ <span class="ruby-keyword">end</span>
233
+ <span class="ruby-identifier">ret_string</span>
234
+ <span class="ruby-keyword">end</span>
235
+ <span class="ruby-keyword">end</span></pre>
236
+ </div><!-- csv_each-source -->
237
+
238
+ </div>
239
+
240
+
241
+
242
+
243
+ </div><!-- csv_each-method -->
244
+
245
+
206
246
  <div id="method-i-print_each" class="method-detail ">
207
247
 
208
248
  <div class="method-heading">
@@ -289,7 +329,7 @@ use almost instance methods of SDBM class.</p>
289
329
 
290
330
 
291
331
  <div class="method-source-code" id="print_values-source">
292
- <pre><span class="ruby-comment"># File lib/hakto/safe_sdbm.rb, line 56</span>
332
+ <pre><span class="ruby-comment"># File lib/hakto/safe_sdbm.rb, line 67</span>
293
333
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_values</span>
294
334
  <span class="ruby-identifier">print_flat</span>(<span class="ruby-string">&quot;values&quot;</span>)
295
335
  <span class="ruby-keyword">end</span></pre>
@@ -0,0 +1,109 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>LICENSE - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body class="file">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="project-metadata">
47
+ <nav id="fileindex-section" class="section project-section">
48
+ <h3 class="section-header">Pages</h3>
49
+
50
+ <ul>
51
+
52
+ <li class="file"><a href="./LICENSE.html">LICENSE</a>
53
+
54
+ <li class="file"><a href="./Rakefile.html">Rakefile</a>
55
+
56
+ </ul>
57
+ </nav>
58
+
59
+ <nav id="classindex-section" class="section project-section">
60
+ <h3 class="section-header">Class and Module Index</h3>
61
+
62
+ <ul class="link-list">
63
+
64
+ <li><a href="./Hakto.html">Hakto</a>
65
+
66
+ <li><a href="./Hakto/SafeSDBM.html">Hakto::SafeSDBM</a>
67
+
68
+ <li><a href="./Object.html">Object</a>
69
+
70
+ <li><a href="./SafeSDBMTest.html">SafeSDBMTest</a>
71
+
72
+ </ul>
73
+ </nav>
74
+
75
+ </div>
76
+ </nav>
77
+
78
+ <div id="documentation" class="description">
79
+
80
+ <p>Copyright © 2012 Moza USANE</p>
81
+
82
+ <p>Permission is hereby granted, free of charge, to any person obtaining a
83
+ copy of this software and associated documentation files (the “Software”),
84
+ to deal in the Software without restriction, including without limitation
85
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
86
+ and/or sell copies of the Software, and to permit persons to whom the
87
+ Software is furnished to do so, subject to the following conditions:</p>
88
+
89
+ <p>The above copyright notice and this permission notice shall be included in
90
+ all copies or substantial portions of the Software.</p>
91
+
92
+ <p>THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
93
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
94
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
95
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
96
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
97
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
98
+ DEALINGS IN THE SOFTWARE.</p>
99
+
100
+ </div>
101
+
102
+
103
+
104
+ <footer id="validator-badges">
105
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
106
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
107
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
108
+ </footer>
109
+
@@ -85,6 +85,8 @@
85
85
 
86
86
  <ul>
87
87
 
88
+ <li class="file"><a href="./LICENSE.html">LICENSE</a>
89
+
88
90
  <li class="file"><a href="./Rakefile.html">Rakefile</a>
89
91
 
90
92
  </ul>
@@ -49,6 +49,8 @@
49
49
 
50
50
  <ul>
51
51
 
52
+ <li class="file"><a href="./LICENSE.html">LICENSE</a>
53
+
52
54
  <li class="file"><a href="./Rakefile.html">Rakefile</a>
53
55
 
54
56
  </ul>
@@ -79,11 +81,24 @@
79
81
 
80
82
  <p>spec = Gem::Specification.new do |s|</p>
81
83
 
82
- <pre>s.name = &quot;hakto&quot;
83
- s.summary = &quot;&quot;</pre>
84
+ <pre class="ruby"><span class="ruby-identifier">s</span>.<span class="ruby-identifier">name</span> = <span class="ruby-string">&quot;hakto&quot;</span>
85
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">summary</span> = <span class="ruby-string">&quot;Hakto Safe SDBM Wrapper is a safe wrapper of SDBM class.&quot;</span>
86
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">description</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>), <span class="ruby-string">&quot;README.md&quot;</span>))
87
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">version</span> = <span class="ruby-string">&quot;0.1.0&quot;</span>
88
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">author</span> = <span class="ruby-string">&quot;Moza USANE&quot;</span>
89
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">email</span> = <span class="ruby-string">&quot;mozamimy@quellencode.org&quot;</span>
90
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">homepage</span> = <span class="ruby-string">&quot;http://blog.quellencode.org/&quot;</span>
91
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">platform</span> = <span class="ruby-constant">Gem</span><span class="ruby-operator">::</span><span class="ruby-constant">Platform</span><span class="ruby-operator">::</span><span class="ruby-constant">RUBY</span>
92
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">required_ruby_version</span> = <span class="ruby-string">&quot;&gt;=1.9&quot;</span>
93
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">files</span> = <span class="ruby-constant">Dir</span>[<span class="ruby-string">&quot;**/**&quot;</span>]
94
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">test_files</span> = <span class="ruby-constant">Dir</span>[<span class="ruby-string">&quot;test/test*.rb&quot;</span>]
95
+ <span class="ruby-identifier">s</span>.<span class="ruby-identifier">has_rdoc</span> = <span class="ruby-keyword">true</span>
96
+ </pre>
84
97
 
85
98
  <p>end</p>
86
99
 
100
+ <p>Rake::GemPackageTask.new(spec).define</p>
101
+
87
102
  </div>
88
103
 
89
104
 
@@ -72,6 +72,8 @@
72
72
 
73
73
  <li><a href="#method-i-capture_stdout">#capture_stdout</a>
74
74
 
75
+ <li><a href="#method-i-csv_each_test">#csv_each_test</a>
76
+
75
77
  <li><a href="#method-i-setup">#setup</a>
76
78
 
77
79
  <li><a href="#method-i-test_add_get">#test_add_get</a>
@@ -107,6 +109,8 @@
107
109
 
108
110
  <ul>
109
111
 
112
+ <li class="file"><a href="./LICENSE.html">LICENSE</a>
113
+
110
114
  <li class="file"><a href="./Rakefile.html">Rakefile</a>
111
115
 
112
116
  </ul>
@@ -193,6 +197,37 @@
193
197
  </div><!-- capture_stdout-method -->
194
198
 
195
199
 
200
+ <div id="method-i-csv_each_test" class="method-detail ">
201
+
202
+ <div class="method-heading">
203
+ <span class="method-name">csv_each_test</span><span
204
+ class="method-args">()</span>
205
+ <span class="method-click-advice">click to toggle source</span>
206
+ </div>
207
+
208
+
209
+ <div class="method-description">
210
+
211
+
212
+
213
+
214
+
215
+ <div class="method-source-code" id="csv_each_test-source">
216
+ <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 62</span>
217
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">csv_each_test</span>
218
+ <span class="ruby-identifier">expected</span> = <span class="ruby-string">&quot;hage,HAGE\r\nfuga,FUGA\r\nsiga,SIGA\r\n&quot;</span>
219
+ <span class="ruby-identifier">assert_equal</span>(<span class="ruby-identifier">expected</span>, <span class="ruby-ivar">@safe_sdbm</span>.<span class="ruby-identifier">csv_each</span>)
220
+ <span class="ruby-keyword">end</span></pre>
221
+ </div><!-- csv_each_test-source -->
222
+
223
+ </div>
224
+
225
+
226
+
227
+
228
+ </div><!-- csv_each_test-method -->
229
+
230
+
196
231
  <div id="method-i-setup" class="method-detail ">
197
232
 
198
233
  <div class="method-heading">
@@ -305,7 +340,7 @@
305
340
 
306
341
 
307
342
  <div class="method-source-code" id="test_db_path-source">
308
- <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 83</span>
343
+ <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 88</span>
309
344
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">test_db_path</span>
310
345
  <span class="ruby-identifier">assert_equal</span>(<span class="ruby-string">&quot;test.sdb&quot;</span>, <span class="ruby-ivar">@safe_sdbm</span>.<span class="ruby-identifier">db_path</span>)
311
346
  <span class="ruby-keyword">end</span></pre>
@@ -431,7 +466,7 @@
431
466
 
432
467
 
433
468
  <div class="method-source-code" id="test_length-source">
434
- <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 87</span>
469
+ <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 92</span>
435
470
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">test_length</span>
436
471
  <span class="ruby-identifier">assert_equal</span>(<span class="ruby-value">3</span>, <span class="ruby-ivar">@safe_sdbm</span>.<span class="ruby-identifier">length</span>)
437
472
  <span class="ruby-identifier">assert_equal</span>(<span class="ruby-value">3</span>, <span class="ruby-ivar">@safe_sdbm</span>.<span class="ruby-identifier">size</span>)
@@ -493,7 +528,7 @@
493
528
 
494
529
 
495
530
  <div class="method-source-code" id="test_print_each-source">
496
- <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 69</span>
531
+ <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 74</span>
497
532
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">test_print_each</span>
498
533
  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">capture_stdout</span> <span class="ruby-keyword">do</span>
499
534
  <span class="ruby-ivar">@safe_sdbm</span>.<span class="ruby-identifier">print_each</span>
@@ -526,7 +561,7 @@
526
561
 
527
562
 
528
563
  <div class="method-source-code" id="test_print_keys-source">
529
- <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 62</span>
564
+ <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 67</span>
530
565
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">test_print_keys</span>
531
566
  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">capture_stdout</span> <span class="ruby-keyword">do</span>
532
567
  <span class="ruby-ivar">@safe_sdbm</span>.<span class="ruby-identifier">print_keys</span>
@@ -559,7 +594,7 @@
559
594
 
560
595
 
561
596
  <div class="method-source-code" id="test_print_values-source">
562
- <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 76</span>
597
+ <pre><span class="ruby-comment"># File test/tb_safe_sdbm.rb, line 81</span>
563
598
  <span class="ruby-keyword">def</span> <span class="ruby-identifier">test_print_values</span>
564
599
  <span class="ruby-identifier">result</span> = <span class="ruby-identifier">capture_stdout</span> <span class="ruby-keyword">do</span>
565
600
  <span class="ruby-ivar">@safe_sdbm</span>.<span class="ruby-identifier">print_values</span>
@@ -1,4 +1,5 @@
1
- Fri, 07 Dec 2012 10:17:43 +0900
2
- ./Rakefile Fri, 07 Dec 2012 10:17:37 +0900
3
- ./test/tb_safe_sdbm.rb Fri, 07 Dec 2012 10:14:15 +0900
4
- ./lib/hakto/safe_sdbm.rb Fri, 07 Dec 2012 10:09:42 +0900
1
+ Sat, 08 Dec 2012 15:02:36 +0900
2
+ ./Rakefile Sat, 08 Dec 2012 14:46:50 +0900
3
+ ./test/tb_safe_sdbm.rb Sat, 08 Dec 2012 14:44:29 +0900
4
+ ./lib/hakto/safe_sdbm.rb Sat, 08 Dec 2012 15:02:26 +0900
5
+ ./LICENSE Tue, 13 Nov 2012 09:41:23 +0900
@@ -49,6 +49,8 @@
49
49
 
50
50
  <ul>
51
51
 
52
+ <li class="file"><a href="./LICENSE.html">LICENSE</a>
53
+
52
54
  <li class="file"><a href="./Rakefile.html">Rakefile</a>
53
55
 
54
56
  </ul>
@@ -1 +1 @@
1
- var search_data = {"index":{"searchIndex":["hakto","safesdbm","object","safesdbmtest","capture_stdout()","new()","print_each()","print_keys()","print_values()","setup()","test_add_get()","test_clear()","test_db_path()","test_delete()","test_each()","test_keys()","test_length()","test_not_have_close_method()","test_print_each()","test_print_keys()","test_print_values()","rakefile"],"longSearchIndex":["hakto","hakto::safesdbm","object","safesdbmtest","safesdbmtest#capture_stdout()","hakto::safesdbm::new()","hakto::safesdbm#print_each()","hakto::safesdbm#print_keys()","hakto::safesdbm#print_values()","safesdbmtest#setup()","safesdbmtest#test_add_get()","safesdbmtest#test_clear()","safesdbmtest#test_db_path()","safesdbmtest#test_delete()","safesdbmtest#test_each()","safesdbmtest#test_keys()","safesdbmtest#test_length()","safesdbmtest#test_not_have_close_method()","safesdbmtest#test_print_each()","safesdbmtest#test_print_keys()","safesdbmtest#test_print_values()",""],"info":[["Hakto","","Hakto.html","","<p>Hakto Safe SDBM Wrapper is a safe wrapper of SDBM class.\n<p>Author &mdash; Moza USANE (mozamimy@quellencode.org) …\n"],["Hakto::SafeSDBM","","Hakto/SafeSDBM.html","","<p>Wrapper of SDBM class. It provides safe access to SDBM database. You can\nuse almost instance methods …\n"],["Object","","Object.html","",""],["SafeSDBMTest","","SafeSDBMTest.html","",""],["capture_stdout","SafeSDBMTest","SafeSDBMTest.html#method-i-capture_stdout","(&block)",""],["new","Hakto::SafeSDBM","Hakto/SafeSDBM.html#method-c-new","(db_path)","<p>Initialize SafeSDBM.\n<p>Args\n<p>db_path &mdash; A filepath of DB file\n"],["print_each","Hakto::SafeSDBM","Hakto/SafeSDBM.html#method-i-print_each","()","<p>Print key-value pair with following format.\n<p>[key1]:value1\n<p>[key2]:value2\n"],["print_keys","Hakto::SafeSDBM","Hakto/SafeSDBM.html#method-i-print_keys","()","<p>Print keys with following format. key1, key2, key3, …\n"],["print_values","Hakto::SafeSDBM","Hakto/SafeSDBM.html#method-i-print_values","()","<p>Print values with following format. value1, value2, value3, …\n"],["setup","SafeSDBMTest","SafeSDBMTest.html#method-i-setup","()",""],["test_add_get","SafeSDBMTest","SafeSDBMTest.html#method-i-test_add_get","()",""],["test_clear","SafeSDBMTest","SafeSDBMTest.html#method-i-test_clear","()",""],["test_db_path","SafeSDBMTest","SafeSDBMTest.html#method-i-test_db_path","()",""],["test_delete","SafeSDBMTest","SafeSDBMTest.html#method-i-test_delete","()",""],["test_each","SafeSDBMTest","SafeSDBMTest.html#method-i-test_each","()",""],["test_keys","SafeSDBMTest","SafeSDBMTest.html#method-i-test_keys","()",""],["test_length","SafeSDBMTest","SafeSDBMTest.html#method-i-test_length","()",""],["test_not_have_close_method","SafeSDBMTest","SafeSDBMTest.html#method-i-test_not_have_close_method","()",""],["test_print_each","SafeSDBMTest","SafeSDBMTest.html#method-i-test_print_each","()",""],["test_print_keys","SafeSDBMTest","SafeSDBMTest.html#method-i-test_print_keys","()",""],["test_print_values","SafeSDBMTest","SafeSDBMTest.html#method-i-test_print_values","()",""],["Rakefile","","Rakefile.html","","<p>require “rake/gempackagetask”\n<p>spec = Gem::Specification.new do |s|\n\n<pre>s.name = &quot;hakto&quot;\ns.summary ...</pre>\n"]]}}
1
+ var search_data = {"index":{"searchIndex":["hakto","safesdbm","object","safesdbmtest","capture_stdout()","csv_each()","csv_each_test()","new()","print_each()","print_keys()","print_values()","setup()","test_add_get()","test_clear()","test_db_path()","test_delete()","test_each()","test_keys()","test_length()","test_not_have_close_method()","test_print_each()","test_print_keys()","test_print_values()","license","rakefile"],"longSearchIndex":["hakto","hakto::safesdbm","object","safesdbmtest","safesdbmtest#capture_stdout()","hakto::safesdbm#csv_each()","safesdbmtest#csv_each_test()","hakto::safesdbm::new()","hakto::safesdbm#print_each()","hakto::safesdbm#print_keys()","hakto::safesdbm#print_values()","safesdbmtest#setup()","safesdbmtest#test_add_get()","safesdbmtest#test_clear()","safesdbmtest#test_db_path()","safesdbmtest#test_delete()","safesdbmtest#test_each()","safesdbmtest#test_keys()","safesdbmtest#test_length()","safesdbmtest#test_not_have_close_method()","safesdbmtest#test_print_each()","safesdbmtest#test_print_keys()","safesdbmtest#test_print_values()","",""],"info":[["Hakto","","Hakto.html","","<p>Hakto Safe SDBM Wrapper is a safe wrapper of SDBM class.\n<p>Author &mdash; Moza USANE (mozamimy@quellencode.org) …\n"],["Hakto::SafeSDBM","","Hakto/SafeSDBM.html","","<p>Wrapper of SDBM class. It provides safe access to SDBM database. You can\nuse almost instance methods …\n"],["Object","","Object.html","",""],["SafeSDBMTest","","SafeSDBMTest.html","",""],["capture_stdout","SafeSDBMTest","SafeSDBMTest.html#method-i-capture_stdout","(&block)",""],["csv_each","Hakto::SafeSDBM","Hakto/SafeSDBM.html#method-i-csv_each","()","<p>Return key-value pair with CSV format.\n"],["csv_each_test","SafeSDBMTest","SafeSDBMTest.html#method-i-csv_each_test","()",""],["new","Hakto::SafeSDBM","Hakto/SafeSDBM.html#method-c-new","(db_path)","<p>Initialize SafeSDBM.\n<p>Args\n<p>db_path &mdash; A filepath of DB file\n"],["print_each","Hakto::SafeSDBM","Hakto/SafeSDBM.html#method-i-print_each","()","<p>Print key-value pair with following format.\n<p>[key1]:value1\n<p>[key2]:value2\n"],["print_keys","Hakto::SafeSDBM","Hakto/SafeSDBM.html#method-i-print_keys","()","<p>Print keys with following format. key1, key2, key3, …\n"],["print_values","Hakto::SafeSDBM","Hakto/SafeSDBM.html#method-i-print_values","()","<p>Print values with following format. value1, value2, value3, …\n"],["setup","SafeSDBMTest","SafeSDBMTest.html#method-i-setup","()",""],["test_add_get","SafeSDBMTest","SafeSDBMTest.html#method-i-test_add_get","()",""],["test_clear","SafeSDBMTest","SafeSDBMTest.html#method-i-test_clear","()",""],["test_db_path","SafeSDBMTest","SafeSDBMTest.html#method-i-test_db_path","()",""],["test_delete","SafeSDBMTest","SafeSDBMTest.html#method-i-test_delete","()",""],["test_each","SafeSDBMTest","SafeSDBMTest.html#method-i-test_each","()",""],["test_keys","SafeSDBMTest","SafeSDBMTest.html#method-i-test_keys","()",""],["test_length","SafeSDBMTest","SafeSDBMTest.html#method-i-test_length","()",""],["test_not_have_close_method","SafeSDBMTest","SafeSDBMTest.html#method-i-test_not_have_close_method","()",""],["test_print_each","SafeSDBMTest","SafeSDBMTest.html#method-i-test_print_each","()",""],["test_print_keys","SafeSDBMTest","SafeSDBMTest.html#method-i-test_print_keys","()",""],["test_print_values","SafeSDBMTest","SafeSDBMTest.html#method-i-test_print_values","()",""],["LICENSE","","LICENSE.html","","<p>Copyright © 2012 Moza USANE\n<p>Permission is hereby granted, free of charge, to any person obtaining a …\n"],["Rakefile","","Rakefile.html","","<p>require “rake/gempackagetask”\n<p>spec = Gem::Specification.new do |s|\n\n<pre>s.name = &quot;hakto&quot;\ns.summary ...</pre>\n"]]}}
@@ -26,6 +26,9 @@
26
26
  <h2>Pages</h2>
27
27
  <ul>
28
28
  <li class="file">
29
+ <a href="LICENSE.html">LICENSE</a>
30
+ </li>
31
+ <li class="file">
29
32
  <a href="Rakefile.html">Rakefile</a>
30
33
  </li>
31
34
 
@@ -55,6 +58,10 @@
55
58
 
56
59
  <li class="method"><a href="SafeSDBMTest.html#method-i-capture_stdout">#capture_stdout &mdash; SafeSDBMTest</a>
57
60
 
61
+ <li class="method"><a href="Hakto/SafeSDBM.html#method-i-csv_each">#csv_each &mdash; Hakto::SafeSDBM</a>
62
+
63
+ <li class="method"><a href="SafeSDBMTest.html#method-i-csv_each_test">#csv_each_test &mdash; SafeSDBMTest</a>
64
+
58
65
  <li class="method"><a href="Hakto/SafeSDBM.html#method-i-print_each">#print_each &mdash; Hakto::SafeSDBM</a>
59
66
 
60
67
  <li class="method"><a href="Hakto/SafeSDBM.html#method-i-print_keys">#print_keys &mdash; Hakto::SafeSDBM</a>
@@ -53,6 +53,17 @@ module Hakto
53
53
  end
54
54
  end
55
55
 
56
+ # Return key-value pair with CSV format.
57
+ def csv_each
58
+ operate do |dbm|
59
+ ret_string = ""
60
+ dbm.each_pair do |key, value|
61
+ ret_string += "#{key},#{value}\r\n"
62
+ end
63
+ ret_string
64
+ end
65
+ end
66
+
56
67
  # Print values with following format.
57
68
  # value1, value2, value3, ...
58
69
  def print_values
@@ -61,6 +61,11 @@ class SafeSDBMTest < Test::Unit::TestCase
61
61
  assert_equal("hage:HAGE,fuga:FUGA,siga:SIGA,", result)
62
62
  end
63
63
 
64
+ def csv_each_test
65
+ expected = "hage,HAGE\r\nfuga,FUGA\r\nsiga,SIGA\r\n"
66
+ assert_equal(expected, @safe_sdbm.csv_each)
67
+ end
68
+
64
69
  def test_print_keys
65
70
  result = capture_stdout do
66
71
  @safe_sdbm.print_keys
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hakto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-07 00:00:00.000000000 Z
12
+ date: 2012-12-08 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! "Hakto Safe SDBM Wrapper\n=======================\n\n## Introduction\n\nHakto
15
15
  Safe SDBM Wrapper is a safe wrapper of SDBM library. Hakto has compatibility of
@@ -20,19 +20,21 @@ description: ! "Hakto Safe SDBM Wrapper\n=======================\n\n## Introduct
20
20
  \ end\n end\n \n def method2\n SDBM.open(@db_path) do
21
21
  |dbm|\n dbm[\"hoge\"]\n end\n end\n \n :\n \n
22
22
  \ end \n\n**after**\n\n class Klass\n def initialize(db_path)\n
23
- \ @sdb = SafeSDBM.new(db_path)\n end\n \n def method1\n sdb[\"hoge\"]
24
- = \"HOGE\"\n end\n \n def method2\n sdb[\"hoge\"]\n end\n
25
- \ \n :\n \n end \n\n\n\n## Operation Environment\n\nWe
23
+ \ @sdb = Hakto::SafeSDBM.new(db_path)\n end\n \n def method1\n
24
+ \ sdb[\"hoge\"] = \"HOGE\"\n end\n \n def method2\n sdb[\"hoge\"]\n
25
+ \ end\n \n :\n \n end \n\n\n\n## Operation Environment\n\nWe
26
26
  checked good operation within following environment.\n\n- Linux(openSUSE 12.2)・Mac
27
27
  OS X 10.8.2\n- Ruby 1.9.3\n\n## Architectonics\n\n- **bin**\n- **doc** :: Rdoc documents.\n-
28
28
  **lib**\n - **hakto**\n - **safe_sdbm.rb** :: Class of SafeSDBM\n- **LICENSE**\n-
29
29
  **Rakefile** :: Rakefile that is used to generate gem file\n- **README.md**\n- **README_jp.md**\n-
30
30
  **test** :: Unit tests\n - **tb_safe_sdbm.rb** :: Unit test for SafeSDBM\n \n##
31
31
  Install\n\nDownload hakto-x.y.z.gem, then execute following command to install Hakto.\n\n`$
32
- sudo gem install hakto-x.y.z.gem`\n\nAlso you can install Hakto without gem. Allocate
33
- the safe_sdbm.rb where is ruby interpreter can load Hakto.\n\n## Sample code\n\nSee
34
- tb_safe_sdbm.rb file. It is an unit test code, and it doubles with sample code.\n\n##
35
- About Author\n\nMoza USANE \n[http://blog.quellencode.org/](http://blog.quellencode.org/
32
+ sudo gem install hakto-x.y.z.gem`\n\nOn the other hand, you can install from RubyGems.org
33
+ to use following command.\n\n`$ sudo gem install hakto`\n\nAlso you can install
34
+ Hakto without gem. Allocate the safe_sdbm.rb where is ruby interpreter can load
35
+ Hakto.\n\n## Sample code\n\nSee tb_safe_sdbm.rb file. It is an unit test code, and
36
+ it doubles with sample code.\n\n## API document\n\nSee following website: [http://quellencode.org/hakto-doc/](http://quellencode.org/hakto-doc/
37
+ \"\")\n\n## About Author\n\nMoza USANE \n[http://blog.quellencode.org/](http://blog.quellencode.org/
36
38
  \"\") \nmozamimy@quellencode.org"
37
39
  email: mozamimy@quellencode.org
38
40
  executables: []
@@ -40,6 +42,7 @@ extensions: []
40
42
  extra_rdoc_files: []
41
43
  files:
42
44
  - README.md
45
+ - CHANGELOG_jp.md
43
46
  - Rakefile
44
47
  - test/test.sdb.pag
45
48
  - test/tb_safe_sdbm.rb
@@ -81,10 +84,12 @@ files:
81
84
  - doc/js/jquery.js
82
85
  - doc/SafeSDBMTest.html
83
86
  - doc/Hakto.html
87
+ - doc/LICENSE.html
84
88
  - doc/table_of_contents.html
85
89
  - doc/Rakefile.html
86
90
  - doc/index.html
87
91
  - doc/Hakto/SafeSDBM.html
92
+ - CHANGELOG.md
88
93
  - LICENSE
89
94
  homepage: http://blog.quellencode.org/
90
95
  licenses: []