jkf 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.en.md CHANGED
@@ -1,38 +1,40 @@
1
- # Jkf
1
+ # jkf gem
2
+
2
3
  [![Gem
3
4
  Version](https://badge.fury.io/rb/jkf.svg)](https://badge.fury.io/rb/jkf)
4
5
  [![Build
5
6
  Status](https://travis-ci.org/iyuuya/jkf.svg?branch=master)](https://travis-ci.org/iyuuya/jkf)
6
7
  [![CI](https://github.com/iyuuya/jkf/actions/workflows/ci.yml/badge.svg)](https://github.com/iyuuya/jkf/actions/workflows/ci.yml)
7
- [![Inline
8
- docs](http://inch-ci.org/github/iyuuya/jkf.svg?branch=develop)](http://inch-ci.org/github/iyuuya/jkf)
9
8
 
10
- jkf is a Ruby port of
11
- [json-kifu-format](https://github.com/na2hiro/json-kifu-format).
12
- It supports both of the conversion from KIF, KI2, or CSA to jkf, and the one
13
- from jkf to KIF, KI2, or CSA.
9
+ The jkf gem is a Ruby port of [json-kifu-format (JKF)][jkf].
10
+ It supports both of the conversion from KIF (see [棋譜ファイル KIF 形式][kakinoki]),
11
+ KI2, or CSA (see [CSA標準棋譜ファイル形式][csa]) to JKF, and the one from JKF to KIF,
12
+ KI2, or CSA.
13
+
14
+ [csa]: http://www2.computer-shogi.org/protocol/record_v22.html
15
+ [jkf]:
16
+ https://github.com/na2hiro/Kifu-for-JS/tree/master/packages/json-kifu-format
17
+ [kakinoki]: http://kakinoki.o.oo7.jp/kif_format.html
14
18
 
15
19
  ## Installation
16
20
 
17
- If you install this gem to your application (with Bundler), add this to
18
- Gemfile.
21
+ If you install this gem to your application (with [Bundler][bundler]), add
22
+ this to `Gemfile`.
23
+
24
+ [bundler]: https://bundler.io/
19
25
 
20
26
  ```ruby
21
27
  gem 'jkf'
22
28
  ```
23
29
 
24
- Then run bundle to install this gem.
30
+ Then run `bundle` to install this gem.
25
31
 
26
- $ bundle
27
-
28
- Or directly install with gem install command.
29
-
30
- $ gem install jkf
32
+ Or directly install with `gem install` command.
31
33
 
32
34
  ## Usage
33
35
 
34
- This gem has the Parser and the Converter for each formats: KIF, KI2, and
35
- CSA.
36
+ This gem has the parser {Jkf::Parser} and the converter {Jkf::Converter} for
37
+ each formats: KIF, KI2, and CSA.
36
38
 
37
39
  ```ruby
38
40
  kif_parser = Jkf::Parser::Kif.new
@@ -46,8 +48,8 @@ ki2_converter = Jkf::Converter::Ki2.new
46
48
  csa_converter = Jkf::Converter::Csa.new
47
49
  ```
48
50
 
49
- `parser#parse(str)` to convert into jkf.
50
- `#convert(jkf)` to convert into each formats from jkf.
51
+ {Jkf::Parser::Base#parse} to convert into JKF.
52
+ {Jkf::Converter::Base#convert} to convert into each formats from JKF.
51
53
 
52
54
  ```ruby
53
55
  jkf = kif_parser.parse(kif_str) #=> Hash
@@ -63,13 +65,15 @@ csa = csa_converter.convert(jkf) #=> String
63
65
 
64
66
  ## Contributing
65
67
 
66
- Feel free to report bugs or send pull requests at
67
- [GitHub](https://github.com/iyuuya/jkf).
68
+ Feel free to report bugs or send pull requests at [the GitHub
69
+ repository][repo].
70
+
71
+ [repo]: https://github.com/iyuuya/jkf
68
72
 
69
73
  If you work on Guix, run tests by `guix shell`.
70
74
 
71
75
  ## License
72
76
 
73
- This gem is licensed under the [MIT
74
- License](http://opensource.org/licenses/MIT).
77
+ This gem is provided under the [MIT License][mit].
75
78
 
79
+ [mit]: http://opensource.org/licenses/MIT
data/README.md CHANGED
@@ -1,28 +1,31 @@
1
- # Jkf
2
- [![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) [![Inline docs](http://inch-ci.org/github/iyuuya/jkf.svg?branch=develop)](http://inch-ci.org/github/iyuuya/jkf)
1
+ # jkf gem
3
2
 
4
- jkfはJSON棋譜フォーマット( https://github.com/na2hiro/json-kifu-format )をRubyに移植したものです。
5
- KIF, KI2, CSAをパースしJKFへ変換、JKFからKIF, KI2, CSAへの変換に対応しています。
3
+ [![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)
6
4
 
7
- ## Installation
5
+ jkf gemは[JSON棋譜フォーマット (JKF)][jkf]をRubyに移植したものです。
6
+ 柿木形式([棋譜ファイル KIF 形式][kakinoki]、KI2)、[CSA標準棋譜ファイル形式][csa]の構文解析とJKFへの変換、JKFからKIF, KI2, CSAへの変換に対応しています。
8
7
 
9
- アプリケーションにインストールする場合(bundlerを使用する場合)、Gemfileに以下のように記述してください。
8
+ [csa]: http://www2.computer-shogi.org/protocol/record_v22.html
9
+ [jkf]: https://github.com/na2hiro/Kifu-for-JS/tree/master/packages/json-kifu-format
10
+ [kakinoki]: http://kakinoki.o.oo7.jp/kif_format.html
11
+
12
+ ## インストール
13
+
14
+ アプリケーションにインストールする場合([Bundler][bundler]を使用する場合)、`Gemfile`に以下のように記述してください。
15
+
16
+ [bundler]: https://bundler.io/
10
17
 
11
18
  ```ruby
12
19
  gem 'jkf'
13
20
  ```
14
21
 
15
- さらにbundleコマンドを実行することでインストールできます。
16
-
17
- $ bundle
22
+ さらに`bundle`コマンドを実行することでインストールできます。
18
23
 
19
- または、gem installコマンドを使って直接インストールすることもできます。
24
+ または、`gem install`コマンドを使って直接インストールもできます。
20
25
 
21
- $ gem install jkf
26
+ ## 使い方
22
27
 
23
- ## Usage
24
-
25
- KIF, KI2, CSAそれぞれParserとConverterが用意してあります。
28
+ KIF, KI2, CSAそれぞれ構文解析器 {Jkf::Parser} と変換器 {Jkf::Converter} が用意してあります。
26
29
 
27
30
  ```ruby
28
31
  kif_parser = Jkf::Parser::Kif.new
@@ -36,7 +39,7 @@ ki2_converter = Jkf::Converter::Ki2.new
36
39
  csa_converter = Jkf::Converter::Csa.new
37
40
  ```
38
41
 
39
- `parser#parse(str)`でjkfへの変換、`#convert(jkf)`でjkfから各フォーマットへ変換できます。
42
+ {Jkf::Parser::Base#parse} でJKFへの変換、 {Jkf::Converter::Base#convert} でJKFから各形式へ変換できます。
40
43
 
41
44
  ```ruby
42
45
  jkf = kif_parser.parse(kif_str) #=> Hash
@@ -50,15 +53,23 @@ ki2 = ki2_converter.convert(jkf) #=> String
50
53
  csa = csa_converter.convert(jkf) #=> String
51
54
  ```
52
55
 
53
- ## Contributing
56
+ ## 貢献
57
+
58
+ バグレポートやプルリクエストは[GitHubのリポジトリ][repo]でよろしくお願いします。
54
59
 
55
- バグレポートやプルリクエストはGithubでよろしくお願いします。
56
- https://github.com/iyuuya/jkf.
60
+ [repo]: https://github.com/iyuuya/jkf
57
61
 
58
62
  Guixで開発されている場合は`guix shell`で`rake test`によるテスト実行ができます。
59
63
 
60
- ## License
64
+ 翻訳はドキュメントとAPIの2種類があります。
65
+ APIについてはRDocの国際化の機能を使います。
66
+ POTファイルの生成には`rdoc --format pot`とします。
67
+ これにより`doc/rdoc.pot`が生成されます。
68
+ このPOTファイルから各言語のPOファイルを初期化できます。
69
+ 例えば`msginit -i doc/rdoc.pot -o po/en.rdoc.po --locale en_US.UTF-8`です。
70
+
71
+ ## 利用許諾
61
72
 
62
- ライセンスはMITです。
63
- [MIT License](http://opensource.org/licenses/MIT).
73
+ ライセンスは[MIT License][mit]です。
64
74
 
75
+ [mit]: http://opensource.org/licenses/MIT
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task default: :spec
7
7
 
8
- desc "translate documents"
8
+ desc 'translate documents'
9
9
  task :translate do
10
- sh "po4a po4a.cfg"
10
+ sh 'po4a po4a.cfg'
11
11
  end
data/bench.rb ADDED
@@ -0,0 +1,12 @@
1
+ require 'benchmark/ips'
2
+ require_relative 'lib/jkf'
3
+
4
+ Benchmark.ips do |x|
5
+ x.report('parse') do
6
+ Dir['spec/*fixtures/**/*'].each do |file|
7
+ Jkf.parse_file(file)
8
+ rescue Jkf::FileTypeError, Jkf::Parser::ParseError
9
+ # okay
10
+ end
11
+ end
12
+ end
data/bin/console CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "jkf"
3
+ require 'bundler/setup'
4
+ require 'jkf'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
8
8
 
9
9
  # (If you use this, don't forget to add pry to your Gemfile!)
10
- if require "pry"
10
+ if require 'pry'
11
11
  Pry.start
12
12
  else
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
15
15
  end
data/jkf.gemspec CHANGED
@@ -1,24 +1,25 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "jkf/version"
3
+ require 'jkf/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = "jkf"
6
+ spec.name = 'jkf'
8
7
  spec.version = Jkf::VERSION
9
- spec.authors = ["iyuuya"]
10
- spec.email = ["i.yuuya@gmail.com"]
8
+ spec.authors = ['iyuuya', 'gemmaro']
9
+ spec.email = ['i.yuuya@gmail.com', 'gemmaro.dev@gmail.com']
11
10
 
12
- spec.summary = "jkf/csa/kif/ki2 parser and converter"
13
- spec.description = "converter/parser of records of shogi"
14
- spec.homepage = "https://github.com/iyuuya/jkf"
15
- spec.license = "MIT"
11
+ spec.summary = 'Shogi formats parser and converter'
12
+ spec.description = 'The jkf gem provides parsers and converters (generaters) for several shogi formats.'
13
+ spec.homepage = 'https://github.com/iyuuya/jkf'
14
+ spec.license = 'MIT'
16
15
 
17
- spec.required_ruby_version = '>= 2.7'
16
+ spec.required_ruby_version = '>= 3.0'
18
17
 
19
18
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
- spec.bindir = "exe"
21
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
- spec.require_paths = ["lib"]
23
- spec.metadata['rubygems_mfa_required'] = 'true'
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.metadata = {
22
+ 'rubygems_mfa_required' => 'true',
23
+ 'documentation_uri' => 'https://www.rubydoc.info/gems/jkf'
24
+ }
24
25
  end
@@ -1,13 +1,15 @@
1
- module Jkf::Converter
2
- # Base of Converter
3
- class Base
4
- # start convert
5
- #
6
- # @param [String, Hash] jkf
7
- # @return [String] kif or ki2 or csa text
8
- def convert(jkf)
9
- jkf = jkf.is_a?(Hash) ? jkf : JSON.parse(jkf)
10
- convert_root(jkf)
1
+ module Jkf
2
+ module Converter
3
+ # Base of Converter
4
+ class Base
5
+ # start convert
6
+ #
7
+ # @param [String, Hash] jkf
8
+ # @return [String] kif or ki2 or csa text
9
+ def convert(jkf)
10
+ jkf = jkf.is_a?(Hash) ? jkf : JSON.parse(jkf)
11
+ convert_root(jkf)
12
+ end
11
13
  end
12
14
  end
13
15
  end
@@ -1,174 +1,165 @@
1
- module Jkf::Converter
2
- # CSA v2.2 Converter
3
- class Csa < Base
4
- VERSION = "2.2".freeze
5
-
6
- protected
7
-
8
- def convert_root(jkf)
9
- result = version
10
- result += convert_information(jkf["header"]) if jkf["header"]
11
- result += convert_initial(jkf["initial"]) if jkf["initial"]
12
- result += convert_moves(jkf["moves"]) if jkf["moves"]
13
- result
14
- end
15
-
16
- def convert_information(header)
17
- result = ""
18
- if header["先手"] || header["下手"]
19
- result += "N+" + (header.delete("先手") || header.delete("下手") || "") + "\n"
20
- end
21
- if header["後手"] || header["上手"]
22
- result += "N-" + (header.delete("後手") || header.delete("上手") || "") + "\n"
1
+ module Jkf
2
+ module Converter
3
+ # CSA v2.2 Converter
4
+ class Csa < Base
5
+ VERSION = '2.2'.freeze
6
+
7
+ protected
8
+
9
+ def convert_root(jkf)
10
+ result = version
11
+ result += convert_information(jkf['header']) if jkf['header']
12
+ result += convert_initial(jkf['initial']) if jkf['initial']
13
+ result += convert_moves(jkf['moves']) if jkf['moves']
14
+ result
23
15
  end
24
- header.each { |(k, v)| result += "$#{csa_header_key(k)}:#{v}\n" }
25
- result
26
- end
27
16
 
28
- def convert_initial(initial)
29
- result = ""
30
- data = initial["data"] || {}
31
- result += if initial["preset"] == "OTHER"
32
- convert_board(data["board"])
33
- else
34
- convert_preset(initial["preset"])
35
- end
36
- # 持駒
37
- if data["hands"]
38
- result += convert_hands(data["hands"], 0)
39
- result += convert_hands(data["hands"], 1)
17
+ def convert_information(header)
18
+ result = ''
19
+ if header['先手'] || header['下手']
20
+ result += 'N+' + (header.delete('先手') || header.delete('下手') || '') + "\n"
21
+ end
22
+ if header['後手'] || header['上手']
23
+ result += 'N-' + (header.delete('後手') || header.delete('上手') || '') + "\n"
24
+ end
25
+ header.each { |(k, v)| result += "$#{csa_header_key(k)}:#{v}\n" }
26
+ result
40
27
  end
41
- result += csa_color(data["color"]) + "\n" if data["color"]
42
- result
43
- end
44
28
 
45
- def convert_hands(hands, color)
46
- result = ""
47
- sum = 0
48
- hands[color].each_value { |n| sum += n }
49
- if sum > 0
50
- result += "P#{csa_color(color)}"
51
- hands[color].to_a.reverse_each { |(k, v)| v.times { result += "00#{k}" } }
52
- result += "\n"
29
+ def convert_initial(initial)
30
+ result = ''
31
+ data = initial['data'] || {}
32
+ result += if initial['preset'] == 'OTHER'
33
+ convert_board(data['board'])
34
+ else
35
+ convert_preset(initial['preset'])
36
+ end
37
+ # 持駒
38
+ if data['hands']
39
+ result += convert_hands(data['hands'], 0)
40
+ result += convert_hands(data['hands'], 1)
41
+ end
42
+ result += csa_color(data['color']) + "\n" if data['color']
43
+ result
53
44
  end
54
- result
55
- end
56
45
 
57
- def convert_moves(moves)
58
- result = ""
59
- before_pos = nil
60
- moves.each do |move|
61
- next if move == {}
62
- result += convert_move(move["move"], before_pos) if move["move"]
63
- result += convert_special(move["special"], move["color"]) if move["special"]
64
- if move["time"]
65
- result += "," + convert_time(move["time"])
66
- elsif move["move"] || move["special"]
46
+ def convert_hands(hands, color)
47
+ result = ''
48
+ sum = 0
49
+ hands[color].each_value { |n| sum += n }
50
+ if sum > 0
51
+ result += "P#{csa_color(color)}"
52
+ hands[color].to_a.reverse_each { |(k, v)| v.times { result += "00#{k}" } }
67
53
  result += "\n"
68
54
  end
69
- result += convert_comments(move["comments"]) if move["comments"]
70
- before_pos = move["move"]["to"] if move["move"] && move["move"]["to"]
55
+ result
71
56
  end
72
- result
73
- end
74
57
 
75
- def convert_move(move, before_pos)
76
- result = csa_color(move["color"])
77
- result += move["from"] ? pos2str(move["from"]) : "00"
78
- result += if move["to"]
79
- pos2str(move["to"]) + move["piece"]
80
- else
81
- pos2str(before_pos) + move["piece"]
82
- end
83
- result
84
- end
58
+ def convert_moves(moves)
59
+ result = ''
60
+ before_pos = nil
61
+ moves.each do |move|
62
+ next if move == {}
63
+ result += convert_move(move['move'], before_pos) if move['move']
64
+ result += convert_special(move['special'], move['color']) if move['special']
65
+ if move['time']
66
+ result += ',' + convert_time(move['time'])
67
+ elsif move['move'] || move['special']
68
+ result += "\n"
69
+ end
70
+ result += convert_comments(move['comments']) if move['comments']
71
+ before_pos = move['move']['to'] if move['move'] && move['move']['to']
72
+ end
73
+ result
74
+ end
85
75
 
86
- def convert_special(special, color = nil)
87
- result = "%"
88
- result += csa_color(color) if color
89
- result + special
90
- end
76
+ def convert_move(move, before_pos)
77
+ result = csa_color(move['color'])
78
+ result += move['from'] ? pos2str(move['from']) : '00'
79
+ result += if move['to']
80
+ pos2str(move['to']) + move['piece']
81
+ else
82
+ pos2str(before_pos) + move['piece']
83
+ end
84
+ result
85
+ end
91
86
 
92
- def convert_time(time)
93
- sec = (time["now"]["m"] * 60) + time["now"]["s"]
94
- "T#{sec}\n"
95
- end
87
+ def convert_special(special, color = nil)
88
+ result = '%'
89
+ result += csa_color(color) if color
90
+ result + special
91
+ end
96
92
 
97
- def convert_comments(comments)
98
- comments.map { |comment| "'#{comment}" }.join("\n") + "\n"
99
- end
93
+ def convert_time(time)
94
+ sec = (time['now']['m'] * 60) + time['now']['s']
95
+ "T#{sec}\n"
96
+ end
100
97
 
101
- def convert_board(board)
102
- result = ""
103
- 9.times do |y|
104
- result += "P#{y + 1}"
105
- 9.times do |x|
106
- piece = board[8 - x][y]
107
- result += if piece == {}
108
- " * "
109
- else
110
- csa_color(piece["color"]) + piece["kind"]
111
- end
112
- end
113
- result += "\n"
98
+ def convert_comments(comments)
99
+ comments.map { |comment| "'#{comment}" }.join("\n") + "\n"
114
100
  end
115
- result
116
- end
117
101
 
118
- def convert_preset(preset)
119
- "PI" +
120
- case preset
121
- when "HIRATE" # 平手
122
- ""
123
- when "KY" # 香落ち
124
- "11KY"
125
- when "KY_R" # 右香落ち
126
- "91KY"
127
- when "KA" # 角落ち
128
- "22KA"
129
- when "HI" # 飛車落ち
130
- "82HI"
131
- when "HIKY" # 飛香落ち
132
- "22HI11KY91KY"
133
- when "2" # 二枚落ち
134
- "82HI22KA"
135
- when "3" # 三枚落ち
136
- "82HI22KA91KY"
137
- when "4" # 四枚落ち
138
- "82HI22KA11KY91KY"
139
- when "5" # 五枚落ち
140
- "82HI22KA81KE11KY91KY"
141
- when "5_L" # 左五枚落ち
142
- "82HI22KA21KE11KY91KY"
143
- when "6" # 六枚落ち
144
- "82HI22KA21KE81KE11KY91KY"
145
- when "8" # 八枚落ち
146
- "82HI22KA31GI71GI21KE81KE11KY91KY"
147
- when "10" # 十枚落ち
148
- "82HI22KA41KI61KI31GI71GI21KE81KE11KY91KY"
102
+ def convert_board(board)
103
+ result = ''
104
+ 9.times do |y|
105
+ result += "P#{y + 1}"
106
+ 9.times do |x|
107
+ piece = board[8 - x][y]
108
+ result += if piece == {}
109
+ ' * '
110
+ else
111
+ csa_color(piece['color']) + piece['kind']
112
+ end
113
+ end
114
+ result += "\n"
149
115
  end
150
- end
116
+ result
117
+ end
151
118
 
152
- def csa_color(color)
153
- color == 0 ? "+" : "-"
154
- end
119
+ def convert_preset(preset)
120
+ 'PI' + PRESET_NAME_TO_CSA_MAPPING[preset]
121
+ end
155
122
 
156
- def pos2str(pos)
157
- "%d%d" % [pos["x"], pos["y"]]
158
- end
123
+ PRESET_NAME_TO_CSA_MAPPING = {
124
+ 'HIRATE' => '', # 平手
125
+ 'KY' => '11KY', # 香落ち
126
+ 'KY_R' => '91KY', # 右香落ち
127
+ 'KA' => '22KA', # 角落ち
128
+ 'HI' => '82HI', # 飛車落ち
129
+ 'HIKY' => '22HI11KY91KY', # 飛香落ち
130
+ '2' => '82HI22KA', # 二枚落ち
131
+ '3' => '82HI22KA91KY', # 三枚落ち
132
+ '4' => '82HI22KA11KY91KY', # 四枚落ち
133
+ '5' => '82HI22KA81KE11KY91KY', # 五枚落ち
134
+ '5_L' => '82HI22KA21KE11KY91KY', # 左五枚落ち
135
+ '6' => '82HI22KA21KE81KE11KY91KY', # 六枚落ち
136
+ '8' => '82HI22KA31GI71GI21KE81KE11KY91KY', # 八枚落ち
137
+ '10' => '82HI22KA41KI61KI31GI71GI21KE81KE11KY91KY' # 十枚落ち
138
+ }.freeze
139
+
140
+ private_constant :PRESET_NAME_TO_CSA_MAPPING
141
+
142
+ def csa_color(color)
143
+ color == 0 ? '+' : '-'
144
+ end
159
145
 
160
- def version
161
- "V#{VERSION}\n"
162
- end
146
+ def pos2str(pos)
147
+ '%d%d' % [pos['x'], pos['y']]
148
+ end
149
+
150
+ def version
151
+ "V#{VERSION}\n"
152
+ end
163
153
 
164
- def csa_header_key(key)
165
- {
166
- "棋戦" => "EVENT",
167
- "場所" => "SITE",
168
- "開始日時" => "START_TIME",
169
- "終了日時" => "END_TIME",
170
- "持ち時間" => "TIME_LIMIT"
171
- }[key] || key
154
+ def csa_header_key(key)
155
+ {
156
+ '棋戦' => 'EVENT',
157
+ '場所' => 'SITE',
158
+ '開始日時' => 'START_TIME',
159
+ '終了日時' => 'END_TIME',
160
+ '持ち時間' => 'TIME_LIMIT'
161
+ }[key] || key
162
+ end
172
163
  end
173
164
  end
174
165
  end