copy_tuner_client 0.15.1 → 0.16.0

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: 3bee0aa592ac55f910bb251d75f275c40bd9674ddc545ce24b93b52bfc324a0a
4
- data.tar.gz: 8a207dead36f198d23b34904664f6ffebebc81e99b997b42d1e589536fd79ecf
3
+ metadata.gz: d026c94fe7b434afec7fa13369e91ddd784ed649336de71bb5d2d0a373201e0f
4
+ data.tar.gz: f882fbc15358fb560d5ba695e138f2ca904ed3f1e4e5b29ccac1a4c3d7e9fe06
5
5
  SHA512:
6
- metadata.gz: 3fcfff507f94229efafd05f0e8d5adbb03033a994dcba41dcdebbcc46cbee67b0702dac4382b41f6e947e8f764337563f8d46b4ec2ba2bb93ef7a92ac2b4b4b8
7
- data.tar.gz: 29c4f29e1ab815e82c35d9328d1e57633a782b943fad22ef691e94c2c009c8dd8f3cdc96e29081cf91de8e956b4a9741628b1dc45c32a99a1b5c0f867d838fe2
6
+ metadata.gz: fc0818f17179df0462efa7a739edbd1126d4b0170d550e15834980eeaf15c61197345b2a82dc2affc911d7914a82abbb5c5a70ff71b9e8d418425841f2f51bf8
7
+ data.tar.gz: ac73b7c43742c17061f318c32ff2f642d53afaa9dad02703a5e166181ac2027312a8a4f5c70626fb77923e29410c026f834db7b4ba1948fe306b6384396fc6d5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.16.0
2
+
3
+ - Railsエンジン内のviewではオリジナルのtヘルパが呼ばれるように修正
4
+
1
5
  ## 0.15.1
2
6
 
3
7
  - tヘルパーにdefault引数が渡された場合に初期値として登録されない問題を修正
@@ -6,6 +6,10 @@ module CopyTunerClient
6
6
  def translate_with_copyray_comment(key, **options)
7
7
  source = translate_without_copyray_comment(key, **options)
8
8
 
9
+ if controller && CopyTunerClient::Rails.controller_of_rails_engine?(controller)
10
+ return source
11
+ end
12
+
9
13
  # TODO: test
10
14
  # NOTE: default引数が設定されている場合は、copytunerキャッシュの値をI18n.t呼び出しにより上書きしている
11
15
  # SEE: https://github.com/rails/rails/blob/6c43ebc220428ce9fc9569c2e5df90a38a4fc4e4/actionview/lib/action_view/helpers/translation_helper.rb#L82
@@ -17,11 +17,16 @@ module CopyTunerClient
17
17
  config.middleware = ::Rails.configuration.middleware
18
18
  end
19
19
  end
20
+
21
+ def self.controller_of_rails_engine?(controller)
22
+ # SEE: https://github.com/rails/rails/blob/539144d2d61770dab66c8643e744441e52538e09/activesupport/lib/active_support/core_ext/module/introspection.rb#L39-L63
23
+ engine_namespaces.include?(controller.class.module_parents[-2])
24
+ end
25
+
26
+ def self.engine_namespaces
27
+ @engine_namespaces ||= ::Rails::Engine.subclasses.filter_map { _1.instance.railtie_namespace }
28
+ end
20
29
  end
21
30
  end
22
31
 
23
- if defined?(::Rails::Railtie)
24
- require 'copy_tuner_client/engine'
25
- else
26
- CopyTunerClient::Rails.initialize
27
- end
32
+ require 'copy_tuner_client/engine'
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '0.15.1'.freeze
3
+ VERSION = '0.16.0'.freeze
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze
@@ -7,6 +7,10 @@ describe CopyTunerClient::HelperExtension do
7
7
  def translate(key, **options)
8
8
  "Hello, #{options[:name]}"
9
9
  end
10
+
11
+ def controller
12
+ nil
13
+ end
10
14
  end
11
15
 
12
16
  class KeywordArgumentsView
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.1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SonicGarden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-06 00:00:00.000000000 Z
11
+ date: 2023-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n