copy_tuner_client 0.14.2 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +3 -1
- data/CHANGELOG.md +8 -0
- data/app/assets/javascripts/copytuner.js +186 -323
- data/copy_tuner_client.gemspec +1 -1
- data/lib/copy_tuner_client/helper_extension.rb +6 -0
- data/lib/copy_tuner_client/version.rb +1 -1
- data/package.json +3 -3
- data/spec/copy_tuner_client/helper_extension_spec.rb +0 -18
- data/spec/copy_tuner_client/i18n_backend_spec.rb +0 -2
- data/yarn.lock +978 -689
- metadata +3 -3
data/package.json
CHANGED
@@ -14,12 +14,12 @@
|
|
14
14
|
},
|
15
15
|
"dependencies": {},
|
16
16
|
"devDependencies": {
|
17
|
-
"@sonicgarden/eslint-plugin": "^0.
|
17
|
+
"@sonicgarden/eslint-plugin": "^0.5.2",
|
18
18
|
"@sonicgarden/prettier-config": "^0.0.1",
|
19
19
|
"eslint": "^8.16.0",
|
20
20
|
"lodash.debounce": "^4.0.8",
|
21
|
-
"typescript": "^
|
22
|
-
"vite": "^2.
|
21
|
+
"typescript": "^5.0.2",
|
22
|
+
"vite": "^4.2.1"
|
23
23
|
},
|
24
24
|
"prettier": "@sonicgarden/prettier-config",
|
25
25
|
"volta": {
|
@@ -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
|
|