jkf 0.5.2 → 0.5.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 365393f77c09c5ca61d79d520d1e8700449f66b9c5f8dd98f3c533d08b5205d6
4
- data.tar.gz: de3a842b9d14005cfff7e9e4d41129b58d0fd9713b91def327e3e579c227498c
3
+ metadata.gz: 9aa24be83e28547743c1bc4c5c12e3b336fe4f448d8cd8f729620c9878a1de42
4
+ data.tar.gz: bc7e2b1eba4f7f9c970d266cba6f4887444dde261169a0e8d52eb02642802e0b
5
5
  SHA512:
6
- metadata.gz: 290f7bd7bec9ccf530ae186a6ee5293827be45fb4b9c3e719d355044b00695d3656e62fd47111d7a7c031ed007d369b51f45518ba48b71a9e80b82dba2b093db
7
- data.tar.gz: c6d9965c4d109352d9fab43dbc17647ded822e02ea24ff41755194c70f8523d7636b43b04df891e127d070bf235c93a63815749adda2b0780260f66778122442
6
+ metadata.gz: 86861a9621a3dc7fa5e7c61fbeeb53c5791bc28fc37b53f3b7bbea44e4f85b0489d4c7b9da2e669432861ac007cf25803dc99c14cbd9b667969df43ef4871a97
7
+ data.tar.gz: 5d2ea1626f6a644760b2ae533fdd5497bd3c5c6e14f73e1001146315008ffd6e5424f5acfe9b0654f8793743baf20a96ca228b8cb42f4b16b8c98b5998868627
data/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## 0.5.3 - 2025-07-21
11
+
12
+ Update project links.
13
+
10
14
  ## 0.5.2 - 2024-10-26
11
15
 
12
16
  This is a maintenance release.
data/Gemfile CHANGED
@@ -2,21 +2,11 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'rake'
6
-
7
5
  group :development do
8
- gem 'redcarpet'
9
6
  gem 'yard'
10
-
11
- gem 'guard-rubocop'
12
- gem 'rubocop', '~> 1.63'
13
- gem 'rubocop-performance'
14
- gem 'rubocop-rake', '~> 0.6.0'
15
- gem 'rubocop-rspec', '~> 3.1'
16
7
  end
17
8
 
18
9
  group :test do
19
- gem 'guard-rspec'
20
10
  gem 'rspec', '~> 3.0'
21
11
  gem 'simplecov'
22
12
  end
data/LICENSE.txt CHANGED
@@ -1,6 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
3
  Copyright (c) 2016 iyuuya
4
+ Copyright (c) 2025 gemmaro
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # jkf gem
2
2
 
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)
4
-
5
3
  jkf gemは[JSON棋譜フォーマット (JKF)][jkf]をRubyに移植したものです。
6
4
  柿木形式([棋譜ファイル KIF 形式][kakinoki]、KI2)、[CSA標準棋譜ファイル形式][csa]の構文解析とJKFへの変換、JKFからKIF, KI2, CSAへの変換に対応しています。
7
5
 
@@ -55,9 +53,9 @@ csa = csa_converter.convert(jkf) #=> String
55
53
 
56
54
  ## 貢献
57
55
 
58
- バグレポートやプルリクエストは[GitHubのリポジトリ][repo]でよろしくお願いします。
56
+ バグレポートやプルリクエストは[リポジトリ][repo]でよろしくお願いします。
59
57
 
60
- [repo]: https://github.com/iyuuya/jkf
58
+ [repo]: https://sourceforge.net/p/ruby-jkf/code/
61
59
 
62
60
  Guixで開発されている場合は`guix shell`で`rake test`によるテスト実行ができます。
63
61
 
@@ -68,6 +66,12 @@ POTファイルの生成には`rdoc --format pot`とします。
68
66
  このPOTファイルから各言語のPOファイルを初期化できます。
69
67
  例えば`msginit -i doc/rdoc.pot -o po/en.rdoc.po --locale en_US.UTF-8`です。
70
68
 
69
+ ## 謝辞
70
+
71
+ このプロジェクトは[GitHubのiyuuya/jkf](https://github.com/iyuuya/jkf)を元にしています。
72
+ そこから[GitHubのgemmaro/jkf](https://github.com/gemmaro/jkf)にフォークされました。
73
+ 現在の開発は[SourceForgeのjkf](https://sourceforge.net/projects/ruby-jkf/)に移っています。
74
+
71
75
  ## 利用許諾
72
76
 
73
77
  ライセンスは[MIT License][mit]です。
data/jkf.gemspec CHANGED
@@ -5,12 +5,12 @@ require 'jkf/version'
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'jkf'
7
7
  spec.version = Jkf::VERSION
8
- spec.authors = ['iyuuya', 'gemmaro']
8
+ spec.authors = %w[iyuuya gemmaro]
9
9
  spec.email = ['i.yuuya@gmail.com', 'gemmaro.dev@gmail.com']
10
10
 
11
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'
12
+ spec.description = 'The jkf gem provides parsers and converters (generaters) for several shogi formats, including json-kifu-format, KIF, KI2, and CSA.'
13
+ spec.homepage = 'https://sourceforge.net/projects/ruby-jkf/'
14
14
  spec.license = 'MIT'
15
15
 
16
16
  spec.required_ruby_version = '>= 3.0'
@@ -22,4 +22,6 @@ Gem::Specification.new do |spec|
22
22
  'rubygems_mfa_required' => 'true',
23
23
  'documentation_uri' => 'https://www.rubydoc.info/gems/jkf'
24
24
  }
25
+
26
+ spec.add_development_dependency "rake"
25
27
  end
@@ -3,7 +3,7 @@ module Jkf
3
3
  # Base of Converter
4
4
  class Base
5
5
  # start convert
6
- #
6
+ #
7
7
  # @param [String, Hash] jkf
8
8
  # @return [String] kif or ki2 or csa text
9
9
  def convert(jkf)
@@ -16,12 +16,8 @@ module Jkf
16
16
 
17
17
  def convert_information(header)
18
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
19
+ result += 'N+' + (header.delete('先手') || header.delete('下手') || '') + "\n" if header['先手'] || header['下手']
20
+ result += 'N-' + (header.delete('後手') || header.delete('上手') || '') + "\n" if header['後手'] || header['上手']
25
21
  header.each { |(k, v)| result += "$#{csa_header_key(k)}:#{v}\n" }
26
22
  result
27
23
  end
@@ -60,6 +56,7 @@ module Jkf
60
56
  before_pos = nil
61
57
  moves.each do |move|
62
58
  next if move == {}
59
+
63
60
  result += convert_move(move['move'], before_pos) if move['move']
64
61
  result += convert_special(move['special'], move['color']) if move['special']
65
62
  if move['time']
@@ -144,7 +141,7 @@ module Jkf
144
141
  end
145
142
 
146
143
  def pos2str(pos)
147
- '%d%d' % [pos['x'], pos['y']]
144
+ format('%d%d', pos['x'], pos['y'])
148
145
  end
149
146
 
150
147
  def version
@@ -57,7 +57,7 @@ module Jkf
57
57
  end
58
58
 
59
59
  def convert_move_line(move, index)
60
- result = '%4d ' % [index]
60
+ result = format('%4d ', index)
61
61
  result += convert_move(move['move'])
62
62
  result += convert_time(move['time']) if move['time']
63
63
  result += '+' if move['forks']
@@ -65,7 +65,7 @@ module Jkf
65
65
  end
66
66
 
67
67
  def convert_special_line(move, index)
68
- result = '%4d ' % [index]
68
+ result = format('%4d ', index)
69
69
  result += ljust(special2kan(move['special']), 13)
70
70
  result += convert_time(move['time']) if move['time']
71
71
  result += '+' if move['forks']
@@ -85,13 +85,8 @@ module Jkf
85
85
  end
86
86
 
87
87
  def convert_time(time)
88
- '(%2d:%02d/%02d:%02d:%02d)' % [
89
- time['now']['m'],
90
- time['now']['s'],
91
- time['total']['h'],
92
- time['total']['m'],
93
- time['total']['s']
94
- ]
88
+ format('(%2d:%02d/%02d:%02d:%02d)', time['now']['m'], time['now']['s'], time['total']['h'], time['total']['m'],
89
+ time['total']['s'])
95
90
  end
96
91
 
97
92
  def special2kan(special)
@@ -119,7 +114,7 @@ module Jkf
119
114
  end
120
115
 
121
116
  def pos2str(pos)
122
- '%d%d' % [pos['x'], pos['y']]
117
+ format('%d%d', pos['x'], pos['y'])
123
118
  end
124
119
  end
125
120
  end
@@ -115,7 +115,7 @@ module Jkf
115
115
 
116
116
  def convert_forks(forks, index)
117
117
  result = "\n"
118
- result = "変化:%4d手\n" % [index] # ki2の場合\nなし
118
+ result = format("変化:%4d手\n", index) # ki2の場合\nなし
119
119
  forks.each do |moves|
120
120
  result += convert_moves(moves, index)
121
121
  end
@@ -131,9 +131,9 @@ module Jkf
131
131
  players_flag = :sengo
132
132
  jkf['header']&.keys&.detect { |key| key =~ /[上下]手/ } && players_flag = :uwasimo
133
133
  @players = if players_flag == :uwasimo
134
- ['', '']
134
+ %w[下 上]
135
135
  else
136
- ['', '']
136
+ %w[先 後]
137
137
  end
138
138
  end
139
139
 
@@ -30,7 +30,7 @@ module Jkf
30
30
  @result != :failed
31
31
  end
32
32
 
33
- def failed?; !success?; end
33
+ def failed? = !success?
34
34
 
35
35
  def match_regexp(reg)
36
36
  matched = @scanner.scan(reg)