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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bee0aa592ac55f910bb251d75f275c40bd9674ddc545ce24b93b52bfc324a0a
|
4
|
+
data.tar.gz: 8a207dead36f198d23b34904664f6ffebebc81e99b997b42d1e589536fd79ecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fcfff507f94229efafd05f0e8d5adbb03033a994dcba41dcdebbcc46cbee67b0702dac4382b41f6e947e8f764337563f8d46b4ec2ba2bb93ef7a92ac2b4b4b8
|
7
|
+
data.tar.gz: 29c4f29e1ab815e82c35d9328d1e57633a782b943fad22ef691e94c2c009c8dd8f3cdc96e29081cf91de8e956b4a9741628b1dc45c32a99a1b5c0f867d838fe2
|
data/CHANGELOG.md
CHANGED
@@ -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
|
@@ -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.
|
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-
|
11
|
+
date: 2023-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|