active_translation 0.7.6 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80d790063e336ec762cf5374a7eb30e2858d04e04ff5c03e952358481262039a
4
- data.tar.gz: 251987c1c7b1147547741567fc819f8680595e486e8d0e67997439305436941b
3
+ metadata.gz: c5060f0fe015b2284bcb3099e6a9287a5dac0bbc8f0cb8f8172c0d068dcfb714
4
+ data.tar.gz: 25abebd6fff9da4101bf2aca097085b9314c0b217b3de1547b597f2f641e95c9
5
5
  SHA512:
6
- metadata.gz: cd8bc53b2c7101fa908b90d8dc6076f63967452b6095f686c6a6590d2e9a40daae08897bb57ff4c1463b37f469344cfe18514b22fcdc42da335c00388e2ab5ab
7
- data.tar.gz: 5fd085e8de592630f851874f68a8079f6de8213c1fc131005894abde22e3f9eb1972b375051f5665c0dbb9accea9bd3d5d6dd77c93471a0add7f4e746dcc587e
6
+ metadata.gz: be37b5420e08aa497dc213784b4101eb09de9fd645fe14c974dbd0659453251242a55e90ffba89afd6194067edfdf3c3a344294b20a63be7fda7a0deb1ad18b4
7
+ data.tar.gz: e9afd718cec5a0a67035c8e6656579e57993caf67ff6e8b39254e6f9b3301c31c894ffeb41e16375b8dd30554cd30063f8d74f37ad200747feecdb3308ba8618
@@ -168,22 +168,14 @@ module ActiveTranslation
168
168
 
169
169
  translated_text = cached_translation&.translated_text || ActiveTranslation::GoogleTranslate.translate(target_language_code: locale, text: send(attribute))
170
170
 
171
- case translation_config[:cache]
172
- when TrueClass
173
- ActiveTranslation::Cache.find_or_create_by(
174
- checksum: text_checksum(send(attribute)),
175
- locale:,
176
- ).update(translated_text:,)
177
- when String, Symbol
178
- return unless attribute.to_s == translation_config[:cache].to_s
179
-
180
- ActiveTranslation::Cache.find_or_create_by(
181
- checksum: text_checksum(send(attribute)),
182
- locale:,
183
- ).update(translated_text:,)
184
- when Array
185
- return unless translation_config[:cache].map(&:to_s).include? attribute.to_s
171
+ should_cache = case translation_config[:cache]
172
+ when TrueClass then true
173
+ when String, Symbol then attribute.to_s == translation_config[:cache].to_s
174
+ when Array then translation_config[:cache].map(&:to_s).include?(attribute.to_s)
175
+ else false
176
+ end
186
177
 
178
+ if should_cache
187
179
  ActiveTranslation::Cache.find_or_create_by(
188
180
  checksum: text_checksum(send(attribute)),
189
181
  locale:,
@@ -1,3 +1,3 @@
1
1
  module ActiveTranslation
2
- VERSION = "0.7.6"
2
+ VERSION = "0.7.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_translation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Talentronic