Skip to content

Latest commit

 

History

History
79 lines (56 loc) · 2.06 KB

README.en.md

File metadata and controls

79 lines (56 loc) · 2.06 KB

jkf gem

Gem Version Build Status CI

The jkf gem is a Ruby port of json-kifu-format (JKF). It supports both of the conversion from KIF (see 棋譜ファイル KIF 形式), KI2, or CSA (see CSA標準棋譜ファイル形式) to JKF, and the one from JKF to KIF, KI2, or CSA.

Installation

If you install this gem to your application (with Bundler), add this to Gemfile.

gem 'jkf'

Then run bundle to install this gem.

Or directly install with gem install command.

Usage

This gem has the parser {Jkf::Parser} and the converter {Jkf::Converter} for each formats: KIF, KI2, and CSA.

kif_parser = Jkf::Parser::Kif.new
ki2_parser = Jkf::Parser::Ki2.new
csa_parser = Jkf::Parser::Csa.new
kif_converter = Jkf::Converter::Kif.new
ki2_converter = Jkf::Converter::Ki2.new
csa_converter = Jkf::Converter::Csa.new

{Jkf::Parser::Base#parse} to convert into JKF. {Jkf::Converter::Base#convert} to convert into each formats from JKF.

jkf = kif_parser.parse(kif_str) #=> Hash
jkf = ki2_parser.parse(ki2_str) #=> Hash
jkf = csa_parser.parse(csa_str) #=> Hash
kif = kif_converter.convert(jkf) #=> String
ki2 = ki2_converter.convert(jkf) #=> String
csa = csa_converter.convert(jkf) #=> String

Contributing

Feel free to report bugs or send pull requests at the GitHub repository.

If you work on Guix, run tests by guix shell.

License

This gem is provided under the MIT License.