copy_tuner_client 0.8.1 → 0.9.0
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:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 996744608bfe0fb4a810ef7f859a0f20f8cb92c2e3646e43fa3f2f380492a0c9
         | 
| 4 | 
            +
              data.tar.gz: e535ee0af12cf52f818077c33dfe05ff40714736dbe7a8afc454257e2ee6fc46
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 76e6d0d13b2b3f311ffbfebd4cbebb98712bfd0a6d15362d8290430a26d28bda58957f54a409821ee5622c0d98eaf8219a1c26829c41a88604b2366073fbd986
         | 
| 7 | 
            +
              data.tar.gz: b476d7b428b800767f8485fb05226c0d0c8b22b2a89396f0de8560f733c99592bd230851f94e03b5b6bf17899979f41dae84fde3248ca20f2f71e00f077fa170
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -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)
         | 
| @@ -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. | 
| 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- | 
| 11 | 
            +
            date: 2021-06-29 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: i18n
         |