yaml-translator 0.10.1 → 0.11.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
  SHA1:
3
- metadata.gz: cfe4e8490871624e96ad985a43faae7283be2239
4
- data.tar.gz: d7e457488fd36a1212c7b1e73fd2afead4d3776e
3
+ metadata.gz: dcb7f84d3b3bb2fa949f3581cd1b2445ba84e4b1
4
+ data.tar.gz: 433c1bd4e72a4fdfdf0c63d5bfcc10f92c35ed77
5
5
  SHA512:
6
- metadata.gz: 5a4b9ed2ded9e00495ad5ca0884295af566c316f18a58b2b1adf03555e1b6d303db4d6b00a6ad00e3f0898ccffe6d775aea889cf24d847f687f66b5ded04220a
7
- data.tar.gz: 50bcb4b98ec58785ded909d0c05e9e993a5a55e091510c4e35224ada24038213b03d1062947fb47be1536e4af38bb580633a188f4791aeac7428060dfe42de1d
6
+ metadata.gz: 72064fedae41fcfd94f49c66aff6734a9bff988c06e9b655e6f32b1895486b6906b995a451b0506d53855becb21bb8f6b99bd66d3f12b693368899055f3a0d4c
7
+ data.tar.gz: 8f10974dc2ed319c16467285bcde311604e77c1943622862a39c8b1c1bcdd9a023064c10e584d87e9da13e4640ffdd4034299cebbb80c93741b70e5669b985a9
data/.travis.yml CHANGED
@@ -5,4 +5,5 @@ rvm:
5
5
  - 2.1
6
6
  - 2.2
7
7
  - 2.3.0
8
+ - 2.4.0
8
9
  cache: bundler
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yaml-translator (0.10.1)
4
+ yaml-translator (0.11.0)
5
5
  diff-lcs
6
6
  easy_translate
7
7
 
@@ -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
- write_file(File.join(dir, "#{lang}.yml"), options)
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={})
@@ -1,3 +1,3 @@
1
1
  module YamlTranslator
2
- VERSION = '0.10.1'
2
+ VERSION = '0.11.0'
3
3
  end
@@ -67,9 +67,19 @@ describe YamlTranslator::Locale do
67
67
  end
68
68
  end
69
69
  describe '#save_to' do
70
- before { locale.save_to(tmp_dir) }
71
- it 'should be write a language file' do
72
- expect(file_exist).to be true
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.10.1
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-19 00:00:00.000000000 Z
11
+ date: 2017-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: easy_translate