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