hakto 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/LICENSE +7 -0
  2. data/README.md +91 -0
  3. data/README_jp.md +92 -0
  4. data/Rakefile +18 -0
  5. data/doc/Hakto/SafeSDBM.html +318 -0
  6. data/doc/Hakto.html +139 -0
  7. data/doc/Object.html +143 -0
  8. data/doc/Rakefile.html +96 -0
  9. data/doc/SafeSDBMTest.html +591 -0
  10. data/doc/created.rid +4 -0
  11. data/doc/images/add.png +0 -0
  12. data/doc/images/brick.png +0 -0
  13. data/doc/images/brick_link.png +0 -0
  14. data/doc/images/bug.png +0 -0
  15. data/doc/images/bullet_black.png +0 -0
  16. data/doc/images/bullet_toggle_minus.png +0 -0
  17. data/doc/images/bullet_toggle_plus.png +0 -0
  18. data/doc/images/date.png +0 -0
  19. data/doc/images/delete.png +0 -0
  20. data/doc/images/find.png +0 -0
  21. data/doc/images/loadingAnimation.gif +0 -0
  22. data/doc/images/macFFBgHack.png +0 -0
  23. data/doc/images/package.png +0 -0
  24. data/doc/images/page_green.png +0 -0
  25. data/doc/images/page_white_text.png +0 -0
  26. data/doc/images/page_white_width.png +0 -0
  27. data/doc/images/plugin.png +0 -0
  28. data/doc/images/ruby.png +0 -0
  29. data/doc/images/tag_blue.png +0 -0
  30. data/doc/images/tag_green.png +0 -0
  31. data/doc/images/transparent.png +0 -0
  32. data/doc/images/wrench.png +0 -0
  33. data/doc/images/wrench_orange.png +0 -0
  34. data/doc/images/zoom.png +0 -0
  35. data/doc/index.html +84 -0
  36. data/doc/js/darkfish.js +153 -0
  37. data/doc/js/jquery.js +18 -0
  38. data/doc/js/navigation.js +142 -0
  39. data/doc/js/search.js +94 -0
  40. data/doc/js/search_index.js +1 -0
  41. data/doc/js/searcher.js +228 -0
  42. data/doc/rdoc.css +543 -0
  43. data/doc/table_of_contents.html +96 -0
  44. data/lib/hakto/safe_sdbm.rb +75 -0
  45. data/test/tb_safe_sdbm.rb +94 -0
  46. data/test/test.sdb.dir +0 -0
  47. data/test/test.sdb.pag +0 -0
  48. metadata +113 -0
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/ruby
2
+ # encoding: utf-8
3
+
4
+ require "test/unit"
5
+ require "stringio"
6
+ require_relative "../lib/hakto/safe_sdbm"
7
+
8
+ include Hakto
9
+
10
+ class SafeSDBMTest < Test::Unit::TestCase
11
+
12
+ def capture_stdout(&block)
13
+ original_stdout = $stdout
14
+ $stdout = fake = StringIO.new
15
+ begin
16
+ yield
17
+ ensure
18
+ $stdout = original_stdout
19
+ end
20
+ fake.string
21
+ end
22
+
23
+ def setup
24
+ @safe_sdbm = SafeSDBM.new("test.sdb")
25
+ @safe_sdbm["hage"] = "HAGE"
26
+ @safe_sdbm["fuga"] = "FUGA"
27
+ @safe_sdbm["siga"] = "SIGA"
28
+ end
29
+
30
+ def test_not_have_close_method
31
+ assert(!SafeSDBM.instance_methods.index(:close))
32
+ assert(!SafeSDBM.instance_methods.index(:closed?))
33
+ end
34
+
35
+ def test_add_get
36
+ assert_equal("HAGE", @safe_sdbm["hage"])
37
+ assert_equal("FUGA", @safe_sdbm["fuga"])
38
+ assert_equal("SIGA", @safe_sdbm["siga"])
39
+ end
40
+
41
+ def test_clear
42
+ @safe_sdbm.clear
43
+ assert_equal([], @safe_sdbm.keys)
44
+ end
45
+
46
+ def test_delete
47
+ @safe_sdbm.delete("fuga")
48
+ assert_equal(["hage", "siga"], @safe_sdbm.keys)
49
+ end
50
+
51
+ def test_keys
52
+ assert_equal(["hage", "fuga", "siga"], @safe_sdbm.keys)
53
+ end
54
+
55
+ def test_each
56
+ result = ""
57
+ @safe_sdbm.each
58
+ @safe_sdbm.each do |key, value|
59
+ result += "#{key}:#{value},"
60
+ end
61
+ assert_equal("hage:HAGE,fuga:FUGA,siga:SIGA,", result)
62
+ end
63
+
64
+ def test_print_keys
65
+ result = capture_stdout do
66
+ @safe_sdbm.print_keys
67
+ end
68
+ assert_equal("hage, fuga, siga, ", result)
69
+ end
70
+
71
+ def test_print_each
72
+ result = capture_stdout do
73
+ @safe_sdbm.print_each
74
+ end
75
+ assert_equal("[hage]:HAGE\n[fuga]:FUGA\n[siga]:SIGA\n", result)
76
+ end
77
+
78
+ def test_print_values
79
+ result = capture_stdout do
80
+ @safe_sdbm.print_values
81
+ end
82
+ assert_equal("HAGE, FUGA, SIGA, ", result)
83
+ end
84
+
85
+ def test_db_path
86
+ assert_equal("test.sdb", @safe_sdbm.db_path)
87
+ end
88
+
89
+ def test_length
90
+ assert_equal(3, @safe_sdbm.length)
91
+ assert_equal(3, @safe_sdbm.size)
92
+ end
93
+
94
+ end
data/test/test.sdb.dir ADDED
File without changes
data/test/test.sdb.pag ADDED
Binary file
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hakto
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Moza USANE
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-12-07 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: ! "Hakto Safe SDBM Wrapper\n=======================\n\n## Introduction\n\nHakto
15
+ Safe SDBM Wrapper is a safe wrapper of SDBM library. Hakto has compatibility of
16
+ instance method's interface that is in SDBM class.\n\nHakto enables to tighten up
17
+ a code that uses SDBM library like following codes.\n\n**before**\n\n class Klass\n
18
+ \ def initialize(db_path)\n @db_path = db_path\n end\n \n def
19
+ method1\n SDBM.open(@db_path) do |dbm|\n dbm[\"hoge\"] = \"HOGE\"\n
20
+ \ end\n end\n \n def method2\n SDBM.open(@db_path) do
21
+ |dbm|\n dbm[\"hoge\"]\n end\n end\n \n :\n \n
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
26
+ checked good operation within following environment.\n\n- Linux(openSUSE 12.2)・Mac
27
+ OS X 10.8.2\n- Ruby 1.9.3\n\n## Architectonics\n\n- **bin**\n- **doc** :: Rdoc documents.\n-
28
+ **lib**\n - **hakto**\n - **safe_sdbm.rb** :: Class of SafeSDBM\n- **LICENSE**\n-
29
+ **Rakefile** :: Rakefile that is used to generate gem file\n- **README.md**\n- **README_jp.md**\n-
30
+ **test** :: Unit tests\n - **tb_safe_sdbm.rb** :: Unit test for SafeSDBM\n \n##
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/
36
+ \"\") \nmozamimy@quellencode.org"
37
+ email: mozamimy@quellencode.org
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - README.md
43
+ - Rakefile
44
+ - test/test.sdb.pag
45
+ - test/tb_safe_sdbm.rb
46
+ - test/test.sdb.dir
47
+ - README_jp.md
48
+ - lib/hakto/safe_sdbm.rb
49
+ - doc/created.rid
50
+ - doc/rdoc.css
51
+ - doc/Object.html
52
+ - doc/images/plugin.png
53
+ - doc/images/zoom.png
54
+ - doc/images/page_green.png
55
+ - doc/images/bullet_toggle_plus.png
56
+ - doc/images/wrench.png
57
+ - doc/images/brick.png
58
+ - doc/images/delete.png
59
+ - doc/images/transparent.png
60
+ - doc/images/bug.png
61
+ - doc/images/ruby.png
62
+ - doc/images/loadingAnimation.gif
63
+ - doc/images/page_white_width.png
64
+ - doc/images/macFFBgHack.png
65
+ - doc/images/bullet_black.png
66
+ - doc/images/wrench_orange.png
67
+ - doc/images/brick_link.png
68
+ - doc/images/package.png
69
+ - doc/images/tag_blue.png
70
+ - doc/images/bullet_toggle_minus.png
71
+ - doc/images/page_white_text.png
72
+ - doc/images/date.png
73
+ - doc/images/find.png
74
+ - doc/images/add.png
75
+ - doc/images/tag_green.png
76
+ - doc/js/searcher.js
77
+ - doc/js/navigation.js
78
+ - doc/js/darkfish.js
79
+ - doc/js/search_index.js
80
+ - doc/js/search.js
81
+ - doc/js/jquery.js
82
+ - doc/SafeSDBMTest.html
83
+ - doc/Hakto.html
84
+ - doc/table_of_contents.html
85
+ - doc/Rakefile.html
86
+ - doc/index.html
87
+ - doc/Hakto/SafeSDBM.html
88
+ - LICENSE
89
+ homepage: http://blog.quellencode.org/
90
+ licenses: []
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '1.9'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 1.8.23
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: Hakto Safe SDBM Wrapper is a safe wrapper of SDBM class.
113
+ test_files: []