copy_tuner_client 1.2.3 → 1.2.4

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: f671e8161b117c8d8d46b5ae56810ccd0e2fc88dbe9d35ab2175d303c89df11c
4
- data.tar.gz: 5cf906cd134cda913900d2e15e970a094b23f01a03f9914c746b0e2da3ee6c26
3
+ metadata.gz: 4ab3f862812c6f70f5157abe63b5d7cc860037be7b429173b33f5e845fca8d5f
4
+ data.tar.gz: f14a689fb3bc5e39de2cbe7489b81c5371f502feec84cb3367de3d57ddf2b673
5
5
  SHA512:
6
- metadata.gz: 84f11e2d259e496f0638b3b8914cc3f88ceda67c6ae1e497f37192fd55347b0f8948abe115c5b91d33ee8feb3acdfb7994fd0af0b4a3118a64ee763dfc458b89
7
- data.tar.gz: 97f296346a8eff7bb3b09ae4b6de6757973ec859e771492962031440626df13548dc25705ebcb355a14e94038444d1223b325c49caff3a1d87f3ec034bde1561
6
+ metadata.gz: ac8dd0b44dc790805421993444bf09e8b28c63a7532796367acfc90e366c7b806e412f6e04d8c451f5c204ebd283e23d15bd9b32ec8912bbbc820e994d184fd4
7
+ data.tar.gz: bcce2f96d4b748280edba1bf962a7e19f93a42e9af74d37a6b10c914e7e98408c1dcc856e771763c8dededa4aa379828d408da133167dad4c512e52c8a6503b8
data/CLAUDE.md CHANGED
@@ -22,6 +22,7 @@ Rails 統合は engine.rb のイニシャライザ経由(ヘルパー/SimpleFo
22
22
  - **RED/TDD で進める**: 実装前に必ず失敗するテストを書き、テストが RED になることを確認してから実装する
23
23
  - 新機能・バグ修正ともに「テスト追加 → RED 確認 → 実装 → GREEN」のサイクルを守る
24
24
  - テストを書かずに実装を先行させない
25
+ - **コメントは WHY のみ日本語で書く**: 識別子やコードから読み取れる WHAT は書かない
25
26
 
26
27
  ## Gotchas
27
28
  - **フロントエンドは `src/*.ts` を編集する。`app/assets/*` は Vite のビルド成果物なので直接編集しない**
@@ -7,7 +7,7 @@ module CopyTunerClient
7
7
  # this class directly.
8
8
  #
9
9
  # Responsible for locking down access to data used by both threads.
10
- class Cache
10
+ class Cache # rubocop:disable Metrics/ClassLength
11
11
  STATUS_NOT_READY = :not_ready
12
12
  STATUS_PENDING = :pending
13
13
  STATUS_READY = :ready
@@ -33,6 +33,10 @@ module CopyTunerClient
33
33
  @status = STATUS_NOT_READY
34
34
  end
35
35
 
36
+ # blank_keys を公開しているのは、MCP ツール等の外部利用者が「キーは登録済みだが翻訳なし」と
37
+ # 「キー未登録」を区別するため(このリポジトリ内では参照箇所がない)。
38
+ attr_reader :last_downloaded_at, :last_uploaded_at, :queued, :blurbs, :blank_keys
39
+
36
40
  # Returns content for the given blurb.
37
41
  # @param key [String] the key of the desired blurb
38
42
  # @return [String] the contents of the blurb
@@ -121,10 +125,12 @@ module CopyTunerClient
121
125
  @status = STATUS_PENDING unless ready?
122
126
 
123
127
  res = client.download(cache_fallback: pending?) do |downloaded_blurbs|
124
- blank_blurbs, blurbs = downloaded_blurbs.partition { |_key, value| value == '' }
128
+ blank_keys = Set.new
129
+ blurbs = {}
130
+ downloaded_blurbs.each { |key, value| value == '' ? blank_keys << key : blurbs[key] = value }
125
131
  lock do
126
- @blank_keys = Set.new(blank_blurbs.map(&:first))
127
- @blurbs = blurbs.to_h
132
+ @blank_keys = blank_keys
133
+ @blurbs = blurbs
128
134
  end
129
135
  end
130
136
 
@@ -143,8 +149,6 @@ module CopyTunerClient
143
149
  flush
144
150
  end
145
151
 
146
- attr_reader :last_downloaded_at, :last_uploaded_at, :queued, :blurbs
147
-
148
152
  def inspect
149
153
  "#<CopyTunerClient::Cache:#{object_id}>"
150
154
  end
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '1.2.3'.freeze
3
+ VERSION = '1.2.4'.freeze
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze
@@ -136,6 +136,7 @@ describe 'CopyTunerClient::Cache' do
136
136
 
137
137
  expect(cache['en.test.key']).to eq('test value')
138
138
  expect(cache['en.test.empty']).to eq(nil)
139
+ expect(cache.blank_keys).to contain_exactly('en.test.empty')
139
140
 
140
141
  cache['en.test.empty'] = ''
141
142
  expect(cache.queued).to be_empty
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copy_tuner_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - SonicGarden