jkf 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/jkf/parser.rb CHANGED
@@ -1,13 +1,11 @@
1
1
  module Jkf
2
- # Define parser namespace
3
2
  module Parser
4
- # Parse error
5
3
  class ParseError < StandardError; end
6
4
  end
7
5
  end
8
6
 
9
- require "jkf/parser/base"
10
- require "jkf/parser/kifuable"
11
- require "jkf/parser/kif"
12
- require "jkf/parser/ki2"
13
- require "jkf/parser/csa"
7
+ require_relative 'parser/base'
8
+ require_relative 'parser/kifuable'
9
+ require_relative 'parser/kif'
10
+ require_relative 'parser/ki2'
11
+ require_relative 'parser/csa'
data/lib/jkf/version.rb CHANGED
@@ -1,4 +1,3 @@
1
1
  module Jkf
2
- # Gem version
3
- VERSION = "0.5.0".freeze
2
+ VERSION = '0.5.1'
4
3
  end
data/lib/jkf.rb CHANGED
@@ -1,7 +1,7 @@
1
- require "kconv"
2
- require "jkf/version"
3
- require "jkf/parser"
4
- require "jkf/converter"
1
+ require 'kconv'
2
+ require_relative 'jkf/version'
3
+ require_relative 'jkf/parser'
4
+ require_relative 'jkf/converter'
5
5
 
6
6
  # JSON Kifu Format
7
7
  module Jkf
@@ -14,7 +14,7 @@ module Jkf
14
14
  # @param [String] filename
15
15
  #
16
16
  # @return [String] KIF, KI2, CSA, JKF(JSON)
17
- def parse_file(filename, encoding: "Shift_JIS")
17
+ def parse_file(filename, encoding: 'Shift_JIS')
18
18
  parser = case ::File.extname(filename)
19
19
  when /kif/
20
20
  ::Jkf::Parser::Kif.new
@@ -43,7 +43,7 @@ module Jkf
43
43
  parsers.each do |parser|
44
44
  begin
45
45
  result = parser.parse(str)
46
- rescue
46
+ rescue StandardError
47
47
  next
48
48
  end
49
49
  break
data/manifest.scm CHANGED
@@ -139,4 +139,5 @@ different gem version combinations.")
139
139
  ruby-rspec
140
140
  ruby-guard-rspec
141
141
  ruby-simplecov
142
+ ruby-benchmark-ips
142
143
  ruby))
data/po/all.pot CHANGED
@@ -7,7 +7,7 @@
7
7
  msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
- "POT-Creation-Date: 2023-06-18 15:22+0900\n"
10
+ "POT-Creation-Date: 2023-06-19 22:27+0900\n"
11
11
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -30,75 +30,81 @@ msgid ""
30
30
  "Version](https://badge.fury.io/rb/jkf.svg)](https://badge.fury.io/rb/jkf) "
31
31
  "[![Build "
32
32
  "Status](https://travis-ci.org/iyuuya/jkf.svg?branch=master)](https://travis-ci.org/iyuuya/jkf) "
33
- "[![CI](https://github.com/iyuuya/jkf/actions/workflows/ci.yml/badge.svg)](https://github.com/iyuuya/jkf/actions/workflows/ci.yml) "
34
- "[![Inline "
35
- "docs](http://inch-ci.org/github/iyuuya/jkf.svg?branch=develop)](http://inch-ci.org/github/iyuuya/jkf)"
33
+ "[![CI](https://github.com/iyuuya/jkf/actions/workflows/ci.yml/badge.svg)](https://github.com/iyuuya/jkf/actions/workflows/ci.yml)"
36
34
  msgstr ""
37
35
 
38
36
  #. type: Plain text
39
37
  #: README.md:6
40
38
  #, markdown-text
41
39
  msgid ""
42
- "jkfはJSON棋譜フォーマット( https://github.com/na2hiro/json-kifu-format "
43
- ")をRubyに移植したものです。 KIF, KI2, CSAをパースしJKFへ変換、JKFからKIF, KI2, CSAへの変換に対応しています。"
40
+ "jkfは[JSON棋譜フォーマット (JKF)][jkf]をRubyに移植したものです。 KIF, KI2, "
41
+ "CSAをパースしJKFへ変換、JKFからKIF, KI2, CSAへの変換に対応しています。"
42
+ msgstr ""
43
+
44
+ #. type: Plain text
45
+ #: README.md:8
46
+ #, markdown-text
47
+ msgid ""
48
+ "[jkf]: "
49
+ "https://github.com/na2hiro/Kifu-for-JS/tree/master/packages/json-kifu-format"
44
50
  msgstr ""
45
51
 
46
52
  #. type: Title ##
47
- #: README.md:7
53
+ #: README.md:9
48
54
  #, markdown-text, no-wrap
49
55
  msgid "Installation"
50
56
  msgstr ""
51
57
 
52
58
  #. type: Plain text
53
- #: README.md:10
59
+ #: README.md:12
54
60
  #, markdown-text
55
61
  msgid "アプリケーションにインストールする場合(bundlerを使用する場合)、Gemfileに以下のように記述してください。"
56
62
  msgstr ""
57
63
 
58
64
  #. type: Fenced code block (ruby)
59
- #: README.md:11
65
+ #: README.md:13
60
66
  #, no-wrap
61
67
  msgid "gem 'jkf'\n"
62
68
  msgstr ""
63
69
 
64
70
  #. type: Plain text
65
- #: README.md:16
71
+ #: README.md:18
66
72
  #, markdown-text
67
73
  msgid "さらにbundleコマンドを実行することでインストールできます。"
68
74
  msgstr ""
69
75
 
70
76
  #. type: Plain text
71
- #: README.md:18
77
+ #: README.md:20
72
78
  #, markdown-text, no-wrap
73
79
  msgid " $ bundle\n"
74
80
  msgstr ""
75
81
 
76
82
  #. type: Plain text
77
- #: README.md:20
83
+ #: README.md:22
78
84
  #, markdown-text
79
85
  msgid "または、gem installコマンドを使って直接インストールすることもできます。"
80
86
  msgstr ""
81
87
 
82
88
  #. type: Plain text
83
- #: README.md:22
89
+ #: README.md:24
84
90
  #, markdown-text, no-wrap
85
91
  msgid " $ gem install jkf\n"
86
92
  msgstr ""
87
93
 
88
94
  #. type: Title ##
89
- #: README.md:23
95
+ #: README.md:25
90
96
  #, markdown-text, no-wrap
91
97
  msgid "Usage"
92
98
  msgstr ""
93
99
 
94
100
  #. type: Plain text
95
- #: README.md:26
101
+ #: README.md:28
96
102
  #, markdown-text
97
103
  msgid "KIF, KI2, CSAそれぞれParserとConverterが用意してあります。"
98
104
  msgstr ""
99
105
 
100
106
  #. type: Fenced code block (ruby)
101
- #: README.md:27
107
+ #: README.md:29
102
108
  #, no-wrap
103
109
  msgid ""
104
110
  "kif_parser = Jkf::Parser::Kif.new\n"
@@ -107,7 +113,7 @@ msgid ""
107
113
  msgstr ""
108
114
 
109
115
  #. type: Fenced code block (ruby)
110
- #: README.md:33
116
+ #: README.md:35
111
117
  #, no-wrap
112
118
  msgid ""
113
119
  "kif_converter = Jkf::Converter::Kif.new\n"
@@ -116,13 +122,13 @@ msgid ""
116
122
  msgstr ""
117
123
 
118
124
  #. type: Plain text
119
- #: README.md:40
125
+ #: README.md:42
120
126
  #, markdown-text
121
127
  msgid "`parser#parse(str)`でjkfへの変換、`#convert(jkf)`でjkfから各フォーマットへ変換できます。"
122
128
  msgstr ""
123
129
 
124
130
  #. type: Fenced code block (ruby)
125
- #: README.md:41
131
+ #: README.md:43
126
132
  #, no-wrap
127
133
  msgid ""
128
134
  "jkf = kif_parser.parse(kif_str) #=> Hash\n"
@@ -131,7 +137,7 @@ msgid ""
131
137
  msgstr ""
132
138
 
133
139
  #. type: Fenced code block (ruby)
134
- #: README.md:47
140
+ #: README.md:49
135
141
  #, no-wrap
136
142
  msgid ""
137
143
  "kif = kif_converter.convert(jkf) #=> String\n"
@@ -140,31 +146,31 @@ msgid ""
140
146
  msgstr ""
141
147
 
142
148
  #. type: Title ##
143
- #: README.md:53
149
+ #: README.md:55
144
150
  #, markdown-text, no-wrap
145
151
  msgid "Contributing"
146
152
  msgstr ""
147
153
 
148
154
  #. type: Plain text
149
- #: README.md:57
155
+ #: README.md:59
150
156
  #, markdown-text
151
157
  msgid "バグレポートやプルリクエストはGithubでよろしくお願いします。 https://github.com/iyuuya/jkf."
152
158
  msgstr ""
153
159
 
154
160
  #. type: Plain text
155
- #: README.md:59
161
+ #: README.md:61
156
162
  #, markdown-text
157
163
  msgid "Guixで開発されている場合は`guix shell`で`rake test`によるテスト実行ができます。"
158
164
  msgstr ""
159
165
 
160
166
  #. type: Title ##
161
- #: README.md:60
167
+ #: README.md:62
162
168
  #, markdown-text, no-wrap
163
169
  msgid "License"
164
170
  msgstr ""
165
171
 
166
172
  #. type: Plain text
167
- #: README.md:64
173
+ #: README.md:66
168
174
  #, markdown-text
169
175
  msgid "ライセンスはMITです。 [MIT License](http://opensource.org/licenses/MIT)."
170
176
  msgstr ""
data/po/en.po CHANGED
@@ -4,8 +4,8 @@
4
4
  msgid ""
5
5
  msgstr ""
6
6
  "Project-Id-Version: jkf gem\n"
7
- "POT-Creation-Date: 2023-06-18 15:22+0900\n"
8
- "PO-Revision-Date: 2023-06-18 15:23+0900\n"
7
+ "POT-Creation-Date: 2023-06-19 22:27+0900\n"
8
+ "PO-Revision-Date: 2023-06-19 22:27+0900\n"
9
9
  "Last-Translator: gemmaro <gemmaro.dev@gmail.com>\n"
10
10
  "Language-Team: none\n"
11
11
  "Language: en\n"
@@ -26,38 +26,37 @@ msgid ""
26
26
  "jkf) [![Build Status](https://travis-ci.org/iyuuya/jkf.svg?branch=master)]"
27
27
  "(https://travis-ci.org/iyuuya/jkf) [![CI](https://github.com/iyuuya/jkf/"
28
28
  "actions/workflows/ci.yml/badge.svg)](https://github.com/iyuuya/jkf/actions/"
29
- "workflows/ci.yml) [![Inline docs](http://inch-ci.org/github/iyuuya/jkf.svg?"
30
- "branch=develop)](http://inch-ci.org/github/iyuuya/jkf)"
31
- msgstr ""
32
- "[![Gem Version](https://badge.fury.io/rb/jkf.svg)](https://badge.fury.io/rb/"
33
- "jkf)\n"
34
- "[![Build Status](https://travis-ci.org/iyuuya/jkf.svg?branch=master)]"
35
- "(https://travis-ci.org/iyuuya/jkf)\n"
36
- "[![CI](https://github.com/iyuuya/jkf/actions/workflows/ci.yml/badge.svg)]"
37
- "(https://github.com/iyuuya/jkf/actions/workflows/ci.yml)\n"
38
- "[![Inline docs](http://inch-ci.org/github/iyuuya/jkf.svg?branch=develop)]"
39
- "(http://inch-ci.org/github/iyuuya/jkf)"
29
+ "workflows/ci.yml)"
30
+ msgstr "[![Gem Version](https://badge.fury.io/rb/jkf.svg)](https://badge.fury.io/rb/jkf) [![Build Status](https://travis-ci.org/iyuuya/jkf.svg?branch=master)](https://travis-ci.org/iyuuya/jkf) [![CI](https://github.com/iyuuya/jkf/actions/workflows/ci.yml/badge.svg)](https://github.com/iyuuya/jkf/actions/workflows/ci.yml)"
40
31
 
41
32
  #. type: Plain text
42
33
  #: README.md:6
43
34
  msgid ""
44
- "jkfはJSON棋譜フォーマット( https://github.com/na2hiro/json-kifu-format )を"
45
- "Rubyに移植したものです。 KIF, KI2, CSAをパースしJKFへ変換、JKFからKIF, KI2, "
46
- "CSAへの変換に対応しています。"
35
+ "jkfは[JSON棋譜フォーマット (JKF)][jkf]をRubyに移植したものです。 KIF, KI2, "
36
+ "CSAをパースしJKFへ変換、JKFからKIF, KI2, CSAへの変換に対応しています。"
47
37
  msgstr ""
48
- "jkf is a Ruby port of [json-kifu-format](https://github.com/na2hiro/json-"
49
- "kifu-format).\n"
38
+ "jkf is a Ruby port of [json-kifu-format][jkf].\n"
50
39
  "It supports both of the conversion from KIF, KI2, or CSA to jkf, and the one "
51
40
  "from jkf to KIF, KI2, or CSA."
52
41
 
42
+ # TODO: insert space after colon; temp po4a limitation
43
+ #. type: Plain text
44
+ #: README.md:8
45
+ msgid ""
46
+ "[jkf]: https://github.com/na2hiro/Kifu-for-JS/tree/master/packages/json-kifu-"
47
+ "format"
48
+ msgstr ""
49
+ "[jkf]:https://github.com/na2hiro/Kifu-for-JS/tree/master/packages/json-kifu-"
50
+ "format"
51
+
53
52
  #. type: Title ##
54
- #: README.md:7
53
+ #: README.md:9
55
54
  #, no-wrap
56
55
  msgid "Installation"
57
56
  msgstr "Installation"
58
57
 
59
58
  #. type: Plain text
60
- #: README.md:10
59
+ #: README.md:12
61
60
  msgid ""
62
61
  "アプリケーションにインストールする場合(bundlerを使用する場合)、Gemfileに以下"
63
62
  "のように記述してください。"
@@ -66,48 +65,48 @@ msgstr ""
66
65
  "Gemfile."
67
66
 
68
67
  #. type: Fenced code block (ruby)
69
- #: README.md:11
68
+ #: README.md:13
70
69
  #, no-wrap
71
70
  msgid "gem 'jkf'\n"
72
71
  msgstr "gem 'jkf'\n"
73
72
 
74
73
  #. type: Plain text
75
- #: README.md:16
74
+ #: README.md:18
76
75
  msgid "さらにbundleコマンドを実行することでインストールできます。"
77
76
  msgstr "Then run bundle to install this gem."
78
77
 
79
78
  #. type: Plain text
80
- #: README.md:18
79
+ #: README.md:20
81
80
  #, no-wrap
82
81
  msgid " $ bundle\n"
83
82
  msgstr " $ bundle\n"
84
83
 
85
84
  #. type: Plain text
86
- #: README.md:20
85
+ #: README.md:22
87
86
  msgid "または、gem installコマンドを使って直接インストールすることもできます。"
88
87
  msgstr "Or directly install with gem install command."
89
88
 
90
89
  #. type: Plain text
91
- #: README.md:22
90
+ #: README.md:24
92
91
  #, no-wrap
93
92
  msgid " $ gem install jkf\n"
94
93
  msgstr " $ gem install jkf\n"
95
94
 
96
95
  #. type: Title ##
97
- #: README.md:23
96
+ #: README.md:25
98
97
  #, no-wrap
99
98
  msgid "Usage"
100
99
  msgstr "Usage"
101
100
 
102
101
  #. type: Plain text
103
- #: README.md:26
102
+ #: README.md:28
104
103
  msgid "KIF, KI2, CSAそれぞれParserとConverterが用意してあります。"
105
104
  msgstr ""
106
105
  "This gem has the Parser and the Converter for each formats: KIF, KI2, and "
107
106
  "CSA."
108
107
 
109
108
  #. type: Fenced code block (ruby)
110
- #: README.md:27
109
+ #: README.md:29
111
110
  #, no-wrap
112
111
  msgid ""
113
112
  "kif_parser = Jkf::Parser::Kif.new\n"
@@ -119,7 +118,7 @@ msgstr ""
119
118
  "csa_parser = Jkf::Parser::Csa.new\n"
120
119
 
121
120
  #. type: Fenced code block (ruby)
122
- #: README.md:33
121
+ #: README.md:35
123
122
  #, no-wrap
124
123
  msgid ""
125
124
  "kif_converter = Jkf::Converter::Kif.new\n"
@@ -131,7 +130,7 @@ msgstr ""
131
130
  "csa_converter = Jkf::Converter::Csa.new\n"
132
131
 
133
132
  #. type: Plain text
134
- #: README.md:40
133
+ #: README.md:42
135
134
  msgid ""
136
135
  "`parser#parse(str)`でjkfへの変換、`#convert(jkf)`でjkfから各フォーマットへ変"
137
136
  "換できます。"
@@ -140,7 +139,7 @@ msgstr ""
140
139
  "`#convert(jkf)` to convert into each formats from jkf."
141
140
 
142
141
  #. type: Fenced code block (ruby)
143
- #: README.md:41
142
+ #: README.md:43
144
143
  #, no-wrap
145
144
  msgid ""
146
145
  "jkf = kif_parser.parse(kif_str) #=> Hash\n"
@@ -152,7 +151,7 @@ msgstr ""
152
151
  "jkf = csa_parser.parse(csa_str) #=> Hash\n"
153
152
 
154
153
  #. type: Fenced code block (ruby)
155
- #: README.md:47
154
+ #: README.md:49
156
155
  #, no-wrap
157
156
  msgid ""
158
157
  "kif = kif_converter.convert(jkf) #=> String\n"
@@ -164,13 +163,13 @@ msgstr ""
164
163
  "csa = csa_converter.convert(jkf) #=> String\n"
165
164
 
166
165
  #. type: Title ##
167
- #: README.md:53
166
+ #: README.md:55
168
167
  #, no-wrap
169
168
  msgid "Contributing"
170
169
  msgstr "Contributing"
171
170
 
172
171
  #. type: Plain text
173
- #: README.md:57
172
+ #: README.md:59
174
173
  msgid ""
175
174
  "バグレポートやプルリクエストはGithubでよろしくお願いします。 https://github."
176
175
  "com/iyuuya/jkf."
@@ -179,20 +178,20 @@ msgstr ""
179
178
  "com/iyuuya/jkf)."
180
179
 
181
180
  #. type: Plain text
182
- #: README.md:59
181
+ #: README.md:61
183
182
  msgid ""
184
183
  "Guixで開発されている場合は`guix shell`で`rake test`によるテスト実行ができま"
185
184
  "す。"
186
185
  msgstr "If you work on Guix, run tests by `guix shell`."
187
186
 
188
187
  #. type: Title ##
189
- #: README.md:60
188
+ #: README.md:62
190
189
  #, no-wrap
191
190
  msgid "License"
192
191
  msgstr "License"
193
192
 
194
193
  #. type: Plain text
195
- #: README.md:64
194
+ #: README.md:66
196
195
  msgid ""
197
196
  "ライセンスはMITです。 [MIT License](http://opensource.org/licenses/MIT)."
198
197
  msgstr ""
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jkf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - iyuuya
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-06-18 00:00:00.000000000 Z
11
+ date: 2023-06-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: converter/parser of records of shogi
14
14
  email:
@@ -30,6 +30,7 @@ files:
30
30
  - README.en.md
31
31
  - README.md
32
32
  - Rakefile
33
+ - bench.rb
33
34
  - bin/console
34
35
  - bin/setup
35
36
  - jkf.gemspec
@@ -64,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
64
65
  requirements:
65
66
  - - ">="
66
67
  - !ruby/object:Gem::Version
67
- version: '2.7'
68
+ version: '3.0'
68
69
  required_rubygems_version: !ruby/object:Gem::Requirement
69
70
  requirements:
70
71
  - - ">="