yaml-translator 0.10.1 → 0.11.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 +4 -4
 - data/.travis.yml +1 -0
 - data/Gemfile.lock +1 -1
 - data/lib/yaml-translator/locale.rb +7 -1
 - data/lib/yaml-translator/version.rb +1 -1
 - data/spec/yaml-translator/locale_spec.rb +13 -3
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: dcb7f84d3b3bb2fa949f3581cd1b2445ba84e4b1
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 433c1bd4e72a4fdfdf0c63d5bfcc10f92c35ed77
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 72064fedae41fcfd94f49c66aff6734a9bff988c06e9b655e6f32b1895486b6906b995a451b0506d53855becb21bb8f6b99bd66d3f12b693368899055f3a0d4c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 8f10974dc2ed319c16467285bcde311604e77c1943622862a39c8b1c1bcdd9a023064c10e584d87e9da13e4640ffdd4034299cebbb80c93741b70e5669b985a9
         
     | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
| 
         @@ -65,8 +65,14 @@ module YamlTranslator 
     | 
|
| 
       65 
65 
     | 
    
         
             
                  target_locale.merge(self)
         
     | 
| 
       66 
66 
     | 
    
         
             
                end
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
      
 68 
     | 
    
         
            +
                # Save the file
         
     | 
| 
      
 69 
     | 
    
         
            +
                #
         
     | 
| 
      
 70 
     | 
    
         
            +
                # @param dir [String] Directory path to save the file
         
     | 
| 
      
 71 
     | 
    
         
            +
                # @param options [Hash] Options for saving
         
     | 
| 
      
 72 
     | 
    
         
            +
                # @return int
         
     | 
| 
       68 
73 
     | 
    
         
             
                def save(dir=Dir.pwd, options={})
         
     | 
| 
       69 
     | 
    
         
            -
                   
     | 
| 
      
 74 
     | 
    
         
            +
                  prefix = options[:prefix] if options.key?(:prefix)
         
     | 
| 
      
 75 
     | 
    
         
            +
                  write_file(File.join(dir, "#{prefix}#{lang}.yml"), options)
         
     | 
| 
       70 
76 
     | 
    
         
             
                end
         
     | 
| 
       71 
77 
     | 
    
         | 
| 
       72 
78 
     | 
    
         
             
                def save_to(dir, options={})
         
     | 
| 
         @@ -67,9 +67,19 @@ describe YamlTranslator::Locale do 
     | 
|
| 
       67 
67 
     | 
    
         
             
                end
         
     | 
| 
       68 
68 
     | 
    
         
             
              end
         
     | 
| 
       69 
69 
     | 
    
         
             
              describe '#save_to' do
         
     | 
| 
       70 
     | 
    
         
            -
                 
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
                   
     | 
| 
      
 70 
     | 
    
         
            +
                context 'when default' do
         
     | 
| 
      
 71 
     | 
    
         
            +
                  before { locale.save_to(tmp_dir) }
         
     | 
| 
      
 72 
     | 
    
         
            +
                  it 'should be write a language file' do
         
     | 
| 
      
 73 
     | 
    
         
            +
                    expect(file_exist).to be true
         
     | 
| 
      
 74 
     | 
    
         
            +
                  end
         
     | 
| 
      
 75 
     | 
    
         
            +
                end
         
     | 
| 
      
 76 
     | 
    
         
            +
                context 'when with prefix option' do
         
     | 
| 
      
 77 
     | 
    
         
            +
                  let(:output_file) { File.join(tmp_dir, 'ns.en.yml') }
         
     | 
| 
      
 78 
     | 
    
         
            +
                  let(:file_exist) { File.exist?(output_file) }
         
     | 
| 
      
 79 
     | 
    
         
            +
                  before { locale.save_to(tmp_dir, prefix: 'ns.') }
         
     | 
| 
      
 80 
     | 
    
         
            +
                  it 'should be write a language file' do
         
     | 
| 
      
 81 
     | 
    
         
            +
                    expect(file_exist).to be true
         
     | 
| 
      
 82 
     | 
    
         
            +
                  end
         
     | 
| 
       73 
83 
     | 
    
         
             
                end
         
     | 
| 
       74 
84 
     | 
    
         
             
              end
         
     | 
| 
       75 
85 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: yaml-translator
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.11.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Noritaka Horio
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2017-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2017-02-27 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: easy_translate
         
     |