copy_tuner_client 0.15.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 375dbe69369421e9f764466f5b92f63b3eacda2235ddc0a42892620ae6474342
4
- data.tar.gz: '07638a3f438bee6a23fa8fa3109cd620585821f417c15693bfcac4589ca053d0'
3
+ metadata.gz: 3bee0aa592ac55f910bb251d75f275c40bd9674ddc545ce24b93b52bfc324a0a
4
+ data.tar.gz: 8a207dead36f198d23b34904664f6ffebebc81e99b997b42d1e589536fd79ecf
5
5
  SHA512:
6
- metadata.gz: bc8bee8ccf7f8668e3d7abb146fe568692a0e765d9fad2bc9137185d34115703a342e2bdd79a5db3a3a0a45e5fabeedd1d70cffa7fc70fc9bd5d81c28cddd3e0
7
- data.tar.gz: 15f30baf267916980605c002524e07818e66aa7dcec62173c9c907acf54e849302862b05cf245bd3cb065668b67dcf39bb0636b62a499af709d99d2c58fdada8
6
+ metadata.gz: 3fcfff507f94229efafd05f0e8d5adbb03033a994dcba41dcdebbcc46cbee67b0702dac4382b41f6e947e8f764337563f8d46b4ec2ba2bb93ef7a92ac2b4b4b8
7
+ data.tar.gz: 29c4f29e1ab815e82c35d9328d1e57633a782b943fad22ef691e94c2c009c8dd8f3cdc96e29081cf91de8e956b4a9741628b1dc45c32a99a1b5c0f867d838fe2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.15.1
2
+
3
+ - tヘルパーにdefault引数が渡された場合に初期値として登録されない問題を修正
4
+
1
5
  ## 0.15.0
2
6
 
3
7
  - Drop support for ruby 2.7
@@ -5,6 +5,12 @@ module CopyTunerClient
5
5
  mod.class_eval do
6
6
  def translate_with_copyray_comment(key, **options)
7
7
  source = translate_without_copyray_comment(key, **options)
8
+
9
+ # TODO: test
10
+ # NOTE: default引数が設定されている場合は、copytunerキャッシュの値をI18n.t呼び出しにより上書きしている
11
+ # SEE: https://github.com/rails/rails/blob/6c43ebc220428ce9fc9569c2e5df90a38a4fc4e4/actionview/lib/action_view/helpers/translation_helper.rb#L82
12
+ I18n.t(key, **options) if options.key?(:default)
13
+
8
14
  if CopyTunerClient.configuration.disable_copyray_comment_injection
9
15
  source
10
16
  else
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '0.15.0'.freeze
3
+ VERSION = '0.15.1'.freeze
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze
@@ -3,36 +3,18 @@ require 'copy_tuner_client/helper_extension'
3
3
  require 'copy_tuner_client/copyray'
4
4
 
5
5
  describe CopyTunerClient::HelperExtension do
6
- # rails <= 6.0.x
7
- module HashArgumentHelper
8
- def translate(key, options = {})
9
- "Hello, #{options[:name]}"
10
- end
11
- end
12
-
13
- # rails >= 6.1.x
14
6
  module KeywordArgumentsHelper
15
7
  def translate(key, **options)
16
8
  "Hello, #{options[:name]}"
17
9
  end
18
10
  end
19
11
 
20
- class HashArgumentView
21
- include HashArgumentHelper
22
- end
23
-
24
12
  class KeywordArgumentsView
25
13
  include KeywordArgumentsHelper
26
14
  end
27
15
 
28
- CopyTunerClient::HelperExtension.hook_translation_helper(HashArgumentHelper, middleware_enabled: true)
29
16
  CopyTunerClient::HelperExtension.hook_translation_helper(KeywordArgumentsHelper, middleware_enabled: true)
30
17
 
31
- it 'works with hash argument method' do
32
- view = HashArgumentView.new
33
- expect(view.translate('some.key', name: 'World')).to eq '<!--COPYRAY some.key-->Hello, World'
34
- end
35
-
36
18
  it 'works with keyword argument method' do
37
19
  view = KeywordArgumentsView.new
38
20
  expect(view.translate('some.key', name: 'World')).to eq '<!--COPYRAY some.key-->Hello, World'
@@ -39,8 +39,6 @@ describe CopyTunerClient::I18nBackend do
39
39
  end
40
40
 
41
41
  it "finds available locales from locale files and cache" do
42
- # TODO: ruby@2.7サポート終わったらこっちは不要
43
- allow(YAML).to receive(:load_file).and_return({ 'es' => { 'key' => 'value' } })
44
42
  allow(YAML).to receive(:unsafe_load_file).and_return({ 'es' => { 'key' => 'value' } })
45
43
  allow(I18n).to receive(:load_path).and_return(["test.yml"])
46
44
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copy_tuner_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SonicGarden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-29 00:00:00.000000000 Z
11
+ date: 2023-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n