From 5a6261e86d8b0d5f1e32c2040e0633216569d529 Mon Sep 17 00:00:00 2001 From: aki Date: Fri, 23 Aug 2024 10:33:58 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20ignored=5Fkeys=E8=A8=AD=E5=AE=9A?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=81=9F=E3=82=AD=E3=83=BC=E3=81=8C=E3=82=A2?= =?UTF-8?q?=E3=83=83=E3=83=97=E3=83=AD=E3=83=BC=E3=83=89=E3=81=95=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E5=A0=B4=E5=90=88=E3=81=AF=E3=82=A8=E3=83=A9=E3=83=BC?= =?UTF-8?q?=E3=81=8C=E7=99=BA=E7=94=9F=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/copy_tuner_client/cache.rb | 7 +++++++ lib/copy_tuner_client/version.rb | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/copy_tuner_client/cache.rb b/lib/copy_tuner_client/cache.rb index 07b3b3d..88552cb 100644 --- a/lib/copy_tuner_client/cache.rb +++ b/lib/copy_tuner_client/cache.rb @@ -18,6 +18,8 @@ def initialize(client, options) @mutex = Mutex.new @exclude_key_regexp = options[:exclude_key_regexp] @upload_disabled = options[:upload_disabled] + @ignored_keys = options.fetch(:ignored_keys, []) + @ignored_key_handler = options.fetch(:ignored_key_handler, -> (e) { raise e }) @locales = Array(options[:locales]).map(&:to_s) # mutable states @blurbs = {} @@ -44,6 +46,11 @@ def []=(key, value) return if @locales.present? && !@locales.member?(key.split('.').first) return if @upload_disabled + key_without_locale = key.split('.')[1..].join('.') + if @ignored_keys.include?(key_without_locale) + @ignored_key_handler.call(IgnoredKey.new("Ignored key: #{key_without_locale}")) + end + lock do return if @blank_keys.member?(key) || @blurbs.key?(key) diff --git a/lib/copy_tuner_client/version.rb b/lib/copy_tuner_client/version.rb index c8d9400..addee7a 100644 --- a/lib/copy_tuner_client/version.rb +++ b/lib/copy_tuner_client/version.rb @@ -1,6 +1,6 @@ module CopyTunerClient # Client version - VERSION = '0.17.1'.freeze + VERSION = '0.18.0'.freeze # API version being used to communicate with the server API_VERSION = '2.0'.freeze