wwwjdic 13.0.0 → 16.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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +63 -1
  3. data/Gemfile +9 -1
  4. data/README.md +499 -225
  5. data/Rakefile +12 -3
  6. data/copyright.md +17 -29
  7. data/examples/basics.rb +55 -45
  8. data/examples/translate.rb +161 -86
  9. data/examples/uri.rb +50 -78
  10. data/html/CHANGELOG.html +80 -21
  11. data/html/COPYING_md.html +13 -24
  12. data/html/Gemfile.html +12 -21
  13. data/html/Object.html +810 -45
  14. data/html/README_md.html +309 -161
  15. data/html/Rakefile.html +15 -24
  16. data/html/WWWJDic.html +41 -81
  17. data/html/WWWJDic/ParsableDuckType.html +15 -34
  18. data/html/WWWJDic/Parser.html +25 -64
  19. data/html/WWWJDic/Parsers.html +8 -13
  20. data/html/WWWJDic/Parsers/Dict.html +29 -54
  21. data/html/WWWJDic/Parsers/Display.html +24 -47
  22. data/html/WWWJDic/Parsers/Key.html +25 -48
  23. data/html/WWWJDic/Parsers/Search.html +19 -38
  24. data/html/WWWJDic/Parsers/Server.html +24 -47
  25. data/html/WWWJDic/Splitter.html +49 -142
  26. data/html/WWWJDic/Utils.html +9 -14
  27. data/html/WWWJDic/Utils/Downloader.html +8 -13
  28. data/html/WWWJDic/Utils/Downloader/Downloader.html +29 -63
  29. data/html/WWWJDic/Utils/Raisers.html +21 -72
  30. data/html/WWWJDic/WWWJDic.html +131 -312
  31. data/html/copyright_md.html +206 -225
  32. data/html/created.rid +33 -58
  33. data/html/css/rdoc.css +35 -6
  34. data/html/index.html +301 -169
  35. data/html/js/darkfish.js +22 -99
  36. data/html/js/navigation.js +4 -40
  37. data/html/js/navigation.js.gz +0 -0
  38. data/html/js/search.js +32 -31
  39. data/html/js/search_index.js +1 -1
  40. data/html/js/search_index.js.gz +0 -0
  41. data/html/js/searcher.js +6 -6
  42. data/html/js/searcher.js.gz +0 -0
  43. data/html/table_of_contents.html +160 -197
  44. data/lib/wwwjdic.rb +16 -15
  45. data/lib/wwwjdic/application.rb +69 -36
  46. data/lib/wwwjdic/constants.rb +48 -10
  47. data/lib/wwwjdic/locales/de.yml +9 -4
  48. data/lib/wwwjdic/locales/en.yml +9 -4
  49. data/lib/wwwjdic/locales/es.yml +9 -4
  50. data/lib/wwwjdic/locales/fr.yml +9 -4
  51. data/lib/wwwjdic/locales/hu.yml +9 -4
  52. data/lib/wwwjdic/locales/it.yml +9 -4
  53. data/lib/wwwjdic/locales/ja.yml +11 -5
  54. data/lib/wwwjdic/locales/nl.yml +9 -4
  55. data/lib/wwwjdic/locales/ru.yml +9 -4
  56. data/lib/wwwjdic/locales/sl.yml +9 -4
  57. data/lib/wwwjdic/locales/sv.yml +9 -4
  58. data/lib/wwwjdic/parser.rb +15 -8
  59. data/lib/wwwjdic/parsers/dict.rb +13 -8
  60. data/lib/wwwjdic/parsers/display.rb +10 -3
  61. data/lib/wwwjdic/parsers/key.rb +11 -3
  62. data/lib/wwwjdic/parsers/search.rb +12 -3
  63. data/lib/wwwjdic/parsers/server.rb +10 -3
  64. data/lib/wwwjdic/utils/downloader.rb +27 -30
  65. data/lib/wwwjdic/utils/raisers.rb +14 -15
  66. data/lib/wwwjdic/utils/splitter.rb +33 -18
  67. data/lib/wwwjdic/version.rb +28 -20
  68. data/test/test_helper.rb +12 -1
  69. data/test/test_wwwjdic.rb +12 -4
  70. data/test/wwwjdic/locales/de.yml +9 -1
  71. data/test/wwwjdic/locales/en.yml +9 -1
  72. data/test/wwwjdic/locales/es.yml +9 -1
  73. data/test/wwwjdic/locales/fr.yml +9 -1
  74. data/test/wwwjdic/locales/hu.yml +9 -1
  75. data/test/wwwjdic/locales/it.yml +10 -1
  76. data/test/wwwjdic/locales/ja.yml +11 -2
  77. data/test/wwwjdic/locales/nl.yml +9 -1
  78. data/test/wwwjdic/locales/ru.yml +9 -1
  79. data/test/wwwjdic/locales/sl.yml +9 -1
  80. data/test/wwwjdic/locales/sv.yml +9 -1
  81. data/test/wwwjdic/locales/test_locales.rb +43 -24
  82. data/test/wwwjdic/parsers/test_dict.rb +67 -37
  83. data/test/wwwjdic/parsers/test_display.rb +13 -5
  84. data/test/wwwjdic/parsers/test_key.rb +12 -4
  85. data/test/wwwjdic/parsers/test_server.rb +13 -5
  86. data/test/wwwjdic/test_application.rb +201 -149
  87. data/test/wwwjdic/test_parsable_duck_type.rb +11 -6
  88. data/test/wwwjdic/utils/test_downloader.rb +9 -1
  89. data/test/wwwjdic/utils/test_raisers.rb +48 -29
  90. data/wwwjdic.gemspec +46 -26
  91. metadata +55 -43
  92. data/acknowledgements.md +0 -55
  93. data/authors.md +0 -67
  94. data/html/acknowledgements_md.html +0 -149
  95. data/html/authors_md.html +0 -181
  96. data/html/js/jquery.js +0 -4
  97. data/html/wwwjdic_gemspec.html +0 -161
@@ -1,5 +1,8 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
3
+ # rubocop:disable Style/AsciiComments
4
+ # © 2014 Marco Bresciani
5
+ # rubocop:enable Style/AsciiComments
3
6
  #
4
7
  # This file is part of wwwjdic.
5
8
  #
@@ -15,6 +18,11 @@
15
18
  #
16
19
  # You should have received a copy of the GNU General Public License
17
20
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
23
+ #
24
+ # SPDX-License-Identifier: GPL-3.0-or-later
25
+ #++
18
26
 
19
27
  en:
20
28
  test:
@@ -1,5 +1,8 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
3
+ # rubocop:disable Style/AsciiComments
4
+ # © 2014 Marco Bresciani
5
+ # rubocop:enable Style/AsciiComments
3
6
  #
4
7
  # This file is part of wwwjdic.
5
8
  #
@@ -15,6 +18,11 @@
15
18
  #
16
19
  # You should have received a copy of the GNU General Public License
17
20
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
23
+ #
24
+ # SPDX-License-Identifier: GPL-3.0-or-later
25
+ #++
18
26
 
19
27
  es:
20
28
  test:
@@ -1,5 +1,8 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
3
+ # rubocop:disable Style/AsciiComments
4
+ # © 2014 Marco Bresciani
5
+ # rubocop:enable Style/AsciiComments
3
6
  #
4
7
  # This file is part of wwwjdic.
5
8
  #
@@ -15,6 +18,11 @@
15
18
  #
16
19
  # You should have received a copy of the GNU General Public License
17
20
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
23
+ #
24
+ # SPDX-License-Identifier: GPL-3.0-or-later
25
+ #++
18
26
 
19
27
  fr:
20
28
  test:
@@ -1,5 +1,8 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
3
+ # rubocop:disable Style/AsciiComments
4
+ # © 2014 Marco Bresciani
5
+ # rubocop:enable Style/AsciiComments
3
6
  #
4
7
  # This file is part of wwwjdic.
5
8
  #
@@ -15,6 +18,11 @@
15
18
  #
16
19
  # You should have received a copy of the GNU General Public License
17
20
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
23
+ #
24
+ # SPDX-License-Identifier: GPL-3.0-or-later
25
+ #++
18
26
 
19
27
  hu:
20
28
  test:
@@ -1,5 +1,8 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
3
+ # rubocop:disable Style/AsciiComments
4
+ # © 2014 Marco Bresciani
5
+ # rubocop:enable Style/AsciiComments
3
6
  #
4
7
  # This file is part of wwwjdic.
5
8
  #
@@ -15,7 +18,13 @@
15
18
  #
16
19
  # You should have received a copy of the GNU General Public License
17
20
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
23
+ #
24
+ # SPDX-License-Identifier: GPL-3.0-or-later
25
+ #++
18
26
 
19
27
  it:
28
+ test:
20
29
  kotoba: parola
21
30
  test: dato di prova
@@ -1,6 +1,9 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2013 新部裕
3
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 新部裕, Marco Bresciani
3
+ # © 2013 新部裕
4
+ # rubocop:disable Style/AsciiComments
5
+ # © 2014 Marco Bresciani
6
+ # rubocop:enable Style/AsciiComments
4
7
  #
5
8
  # This file is part of wwwjdic.
6
9
  #
@@ -16,6 +19,12 @@
16
19
  #
17
20
  # You should have received a copy of the GNU General Public License
18
21
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
22
+ #
23
+ # SPDX-FileCopyrightText: 2013 新部裕
24
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
25
+ #
26
+ # SPDX-License-Identifier: GPL-3.0-or-later
27
+ #++
19
28
 
20
29
  ja:
21
30
  test:
@@ -1,5 +1,8 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
3
+ # rubocop:disable Style/AsciiComments
4
+ # © 2014 Marco Bresciani
5
+ # rubocop:enable Style/AsciiComments
3
6
  #
4
7
  # This file is part of wwwjdic.
5
8
  #
@@ -15,6 +18,11 @@
15
18
  #
16
19
  # You should have received a copy of the GNU General Public License
17
20
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
23
+ #
24
+ # SPDX-License-Identifier: GPL-3.0-or-later
25
+ #++
18
26
 
19
27
  nl:
20
28
  test:
@@ -1,5 +1,8 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
3
+ # rubocop:disable Style/AsciiComments
4
+ # © 2014 Marco Bresciani
5
+ # rubocop:enable Style/AsciiComments
3
6
  #
4
7
  # This file is part of wwwjdic.
5
8
  #
@@ -15,6 +18,11 @@
15
18
  #
16
19
  # You should have received a copy of the GNU General Public License
17
20
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
23
+ #
24
+ # SPDX-License-Identifier: GPL-3.0-or-later
25
+ #++
18
26
 
19
27
  ru:
20
28
  test:
@@ -1,5 +1,8 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
3
+ # rubocop:disable Style/AsciiComments
4
+ # © 2014 Marco Bresciani
5
+ # rubocop:enable Style/AsciiComments
3
6
  #
4
7
  # This file is part of wwwjdic.
5
8
  #
@@ -15,6 +18,11 @@
15
18
  #
16
19
  # You should have received a copy of the GNU General Public License
17
20
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
23
+ #
24
+ # SPDX-License-Identifier: GPL-3.0-or-later
25
+ #++
18
26
 
19
27
  sl:
20
28
  test:
@@ -1,5 +1,8 @@
1
+ #--
1
2
  # wwwjdic
2
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
3
+ # rubocop:disable Style/AsciiComments
4
+ # © 2014 Marco Bresciani
5
+ # rubocop:enable Style/AsciiComments
3
6
  #
4
7
  # This file is part of wwwjdic.
5
8
  #
@@ -15,6 +18,11 @@
15
18
  #
16
19
  # You should have received a copy of the GNU General Public License
17
20
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
21
+ #
22
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
23
+ #
24
+ # SPDX-License-Identifier: GPL-3.0-or-later
25
+ #++
18
26
 
19
27
  sv:
20
28
  test:
@@ -1,6 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # wwwjdic
3
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
5
+ # rubocop:disable Style/AsciiComments
6
+ # © 2014 Marco Bresciani
7
+ # rubocop:enable Style/AsciiComments
4
8
  #
5
9
  # This file is part of wwwjdic.
6
10
  #
@@ -16,49 +20,64 @@
16
20
  #
17
21
  # You should have received a copy of the GNU General Public License
18
22
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
23
+ #
24
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
25
+ #
26
+ # SPDX-License-Identifier: GPL-3.0-or-later
19
27
  #++
20
28
 
21
29
  require_relative '../../test_helper'
22
30
 
23
- describe WWWJDic::WWWJDic do
24
- describe 'when using I18N' do
31
+ RELATIVE_PATH = './'
32
+
33
+ def test_one_locale
34
+ it 'shall return at least one available locale' do
35
+ _(subject).wont_be_nil
36
+ _(subject).wont_be_empty
37
+ end
38
+ end
39
+
40
+ def test_en_it
41
+ it 'shall contain at least English and Italiano' do
42
+ _(subject).must_include :en
43
+ _(subject).must_include :it
44
+ end
45
+ end
25
46
 
26
- RELATIVE_PATH = '/../../../lib/wwwjdic/locales/'
47
+ def test_translation(locale, translation)
48
+ a_string = I18n.t('test.test')
49
+ _(a_string).wont_be_nil
50
+ _(a_string).wont_be_empty
51
+ _(a_string).wont_include 'translation missing'
52
+ _(a_string).must_equal translation[locale.to_s]['test']['test']
53
+ end
27
54
 
55
+ describe WWWJDic::WWWJDic do
56
+ describe 'when using I18N' do
28
57
  before do
29
58
  I18n.load_path = Dir[File.join(File.dirname(__FILE__), RELATIVE_PATH, '*.yml')]
30
59
  end
31
60
 
32
- subject {I18n.available_locales}
61
+ subject { I18n.available_locales }
33
62
 
34
- it 'shall return at least one available locale' do
35
- subject.wont_be_nil
36
- subject.wont_be_empty
37
- end
63
+ test_one_locale
64
+
65
+ test_en_it
38
66
 
39
- it 'shall contain at least English and Italiano' do
40
- subject.must_include :en
41
- subject.must_include :it
67
+ def load_yaml_file(locale)
68
+ filename = File.join(File.dirname(__FILE__), RELATIVE_PATH, "#{locale}.yml")
69
+ filename = File.expand_path filename
70
+ YAML.safe_load(File.open(filename.to_s))
42
71
  end
43
72
 
44
73
  it 'shall contain a test.test signpost for each available locale' do
45
- def load_yaml_file(locale)
46
- filename = File::join(File::dirname(__FILE__), RELATIVE_PATH, "#{locale}.yml")
47
- filename = File::expand_path filename
48
- YAML::load(File::open "#{filename}")
49
- end
50
-
51
74
  subject.each do |locale|
52
75
  I18n.locale = locale
53
76
 
54
77
  translation = load_yaml_file(locale)
55
- translation["#{locale}"]['test']['test'].wont_be_nil
78
+ _(translation[locale.to_s]['test']['test']).wont_be_nil
56
79
 
57
- a_string = I18n.t('test.test')
58
- a_string.wont_be_nil
59
- a_string.wont_be_empty
60
- a_string.wont_include 'translation missing'
61
- a_string.must_equal translation["#{locale}"]['test']['test']
80
+ test_translation(locale, translation)
62
81
  end
63
82
  end
64
83
  end
@@ -1,6 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #--
2
4
  # wwwjdic
3
- # Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
5
+ # rubocop:disable Style/AsciiComments
6
+ # © 2014 Marco Bresciani
7
+ # rubocop:enable Style/AsciiComments
4
8
  #
5
9
  # This file is part of wwwjdic.
6
10
  #
@@ -16,58 +20,84 @@
16
20
  #
17
21
  # You should have received a copy of the GNU General Public License
18
22
  # along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
23
+ #
24
+ # SPDX-FileCopyrightText: 2014 Marco Bresciani
25
+ #
26
+ # SPDX-License-Identifier: GPL-3.0-or-later
19
27
  #++
20
28
 
21
29
  require_relative '../../test_helper'
22
30
 
23
- describe WWWJDic::WWWJDic do
24
- describe 'when using a parser' do
25
- include WWWJDic::ParsableDuckType
31
+ def test_raise_error_param(param)
32
+ it "shall raise and error for parameter '#{param}'" do
33
+ assert_raises ArgumentError do
34
+ subject.parse param
35
+ end
36
+ end
37
+ end
26
38
 
27
- before do
28
- @parser = subject
29
- I18n.load_path = Dir[File.join(File.dirname(__FILE__), '/../../../lib/wwwjdic/locales/', '*.yml')]
39
+ def test_wrong_name
40
+ it 'shall raise an error when wrong dictionary name' do
41
+ assert_raises ArgumentError do
42
+ subject.parse 'test'
30
43
  end
44
+ end
45
+ end
31
46
 
32
- subject {WWWJDic::Parsers::Dict.new}
47
+ def test_wrong_code
48
+ it 'shall raise an error when wrong dictionary code' do
49
+ assert_raises ArgumentError do
50
+ subject.parse 'Z'
51
+ end
52
+ end
53
+ end
33
54
 
34
- describe 'when provided and invalid parameter' do
35
- [nil, '', 42].each do |param|
36
- it "shall raise and error for parameter '#{param}'" do
37
- assert_raises ArgumentError do
38
- subject.parse param
39
- end
40
- end
41
- end
55
+ def test_invalid_param
56
+ describe 'when provided and invalid parameter' do
57
+ [nil, '', 42].each(&method(:test_raise_error_param))
42
58
 
43
- it 'shall raise an error when wrong dictionary name' do
44
- assert_raises ArgumentError do
45
- subject.parse 'test'
46
- end
47
- end
59
+ test_wrong_name
48
60
 
49
- it 'shall raise an error when wrong dictionary code' do
50
- assert_raises ArgumentError do
51
- subject.parse 'Z'
52
- end
61
+ test_wrong_code
62
+ end
63
+ end
64
+
65
+ def test_dictionary_code
66
+ describe 'when using the dictionary code/number' do
67
+ WWWJDic::DICTIONARY_CODES.each do |value|
68
+ it "shall return '#{value}' when parameter is '#{value}'" do
69
+ _(subject.parse(value)).must_equal value
53
70
  end
54
71
  end
72
+ end
73
+ end
55
74
 
56
- describe 'when using the dictionary code/number' do
57
- WWWJDic::DICTIONARY_CODES.each do |value|
58
- it "shall return '#{value}' when parameter is '#{value}'" do
59
- subject.parse(value).must_equal value
60
- end
75
+ def test_dictionary_name
76
+ describe 'when using the dictionary name' do
77
+ WWWJDic::DICTIONARY_NAMES.each do |value|
78
+ translated = WWWJDic::DICTS_BY_NAMES[value]
79
+ it "shall return '#{translated}' when parameter is '#{value}'" do
80
+ _(subject.parse(value)).must_equal translated
61
81
  end
62
82
  end
83
+ end
84
+ end
63
85
 
64
- describe 'when using the dictionary name' do
65
- WWWJDic::DICTIONARY_NAMES.each do |value|
66
- translated = WWWJDic::DICTS_BY_NAMES[value]
67
- it "shall return '#{translated}' when parameter is '#{value}'" do
68
- subject.parse(value).must_equal translated
69
- end
70
- end
86
+ describe WWWJDic::WWWJDic do
87
+ describe 'when using a parser' do
88
+ include WWWJDic::ParsableDuckType
89
+
90
+ before do
91
+ @parser = subject
92
+ I18n.load_path = Dir[File.join(File.dirname(__FILE__), '../locales/', '*.yml')]
71
93
  end
94
+
95
+ subject { WWWJDic::Parsers::Dict.new }
96
+
97
+ test_invalid_param
98
+
99
+ test_dictionary_code
100
+
101
+ test_dictionary_name
72
102
  end
73
103
  end