copy_tuner_client 0.8.1 → 0.9.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: 757532de573065d4b93a08c8bd5061a17c8fbef293d5f14a8ff24bb3815f3323
4
- data.tar.gz: 5d6ceefe8fcb9b2d21ad9592e07d8e0ac68c9ef8684824e57e2a24d5f22afeb1
3
+ metadata.gz: 996744608bfe0fb4a810ef7f859a0f20f8cb92c2e3646e43fa3f2f380492a0c9
4
+ data.tar.gz: e535ee0af12cf52f818077c33dfe05ff40714736dbe7a8afc454257e2ee6fc46
5
5
  SHA512:
6
- metadata.gz: e1effa31089ac5b0b480196ff1fb9700b92b80a2137393467923c84150a252688c2bc4b33f5a1a63c84a58af9128866a22a784111dcd16842a24b0a00437e11f
7
- data.tar.gz: 8e987b21c4b30714b056f2685f57b9b4157f505fb4ef6857b853ab1dd82b3bbaffd442f8add04c8ffed8d0c80d1f52e2eb00d2a452be6859cd42aa048c5ef602
6
+ metadata.gz: 76e6d0d13b2b3f311ffbfebd4cbebb98712bfd0a6d15362d8290430a26d28bda58957f54a409821ee5622c0d98eaf8219a1c26829c41a88604b2366073fbd986
7
+ data.tar.gz: b476d7b428b800767f8485fb05226c0d0c8b22b2a89396f0de8560f733c99592bd230851f94e03b5b6bf17899979f41dae84fde3248ca20f2f71e00f077fa170
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.9.0
2
+
3
+ - Do not upload invalid type keys
4
+
1
5
  ## 0.8.1
2
6
 
3
7
  - Fix bug in `CopyrayMiddleware`
data/Gemfile.lock CHANGED
@@ -14,7 +14,7 @@ GIT
14
14
  PATH
15
15
  remote: .
16
16
  specs:
17
- copy_tuner_client (0.8.1)
17
+ copy_tuner_client (0.9.0)
18
18
  i18n (>= 0.5.0)
19
19
  json
20
20
 
@@ -61,6 +61,8 @@ module CopyTunerClient
61
61
  private
62
62
 
63
63
  def lookup(locale, key, scope = [], options = {})
64
+ return nil if !key.is_a?(String) && !key.is_a?(Symbol)
65
+
64
66
  parts = I18n.normalize_keys(locale, key, scope, options[:separator])
65
67
  key_with_locale = parts.join('.')
66
68
  content = cache[key_with_locale] || super
@@ -86,6 +88,8 @@ module CopyTunerClient
86
88
 
87
89
  def default(locale, object, subject, options = {})
88
90
  content = super(locale, object, subject, options)
91
+ return content if !object.is_a?(String) && !object.is_a?(Symbol)
92
+
89
93
  if content.respond_to?(:to_str)
90
94
  parts = I18n.normalize_keys(locale, object, options[:scope], options[:separator])
91
95
  # NOTE: ActionView::Helpers::TranslationHelper#translate wraps default String in an Array
@@ -19,7 +19,7 @@ module CopyTunerClient
19
19
  def self.install_hook
20
20
  I18n.class_eval do
21
21
  class << self
22
- def translate_with_copy_tuner_hook(key, **options)
22
+ def translate_with_copy_tuner_hook(key = nil, **options)
23
23
  scope = options[:scope]
24
24
  scope = scope.dup if scope.is_a?(Array) || scope.is_a?(String)
25
25
  result = translate_without_copy_tuner_hook(key, **options)
@@ -1,6 +1,6 @@
1
1
  module CopyTunerClient
2
2
  # Client version
3
- VERSION = '0.8.1'.freeze
3
+ VERSION = '0.9.0'.freeze
4
4
 
5
5
  # API version being used to communicate with the server
6
6
  API_VERSION = '2.0'.freeze
@@ -139,6 +139,13 @@ describe CopyTunerClient::I18nBackend do
139
139
  end
140
140
  end
141
141
 
142
+ context 'non-string key' do
143
+ it 'Not to be registered in the cache' do
144
+ expect { subject.translate('en', {}) }.to throw_symbol(:exception)
145
+ expect(cache).not_to have_key 'en.{}'
146
+ end
147
+ end
148
+
142
149
  describe "with stored translations" do
143
150
  subject { build_backend }
144
151
 
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.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SonicGarden
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-15 00:00:00.000000000 Z
11
+ date: 2021-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n