yaml-translator 0.9.2 → 0.10.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: ba16684fa000a47e86f4e74877d2852c36c1526b
4
- data.tar.gz: ce7e0325cc35e11aadfddae1e85a6f7f1bb41734
3
+ metadata.gz: d83ead6bbc4dd7809201407522741dd2fb85ce82
4
+ data.tar.gz: d8462fff5e332c68c41e73e72366ed7e2f43d380
5
5
  SHA512:
6
- metadata.gz: 9b10fdffa997b6c0707d41e027963f02ec636197ecb2d21001fd792f707d819f59af6a20f4cccdb06b1f4f94f1dad21bc38063392ca0f7f540fc404cc5841daf
7
- data.tar.gz: b102408618e93b9a56592b733ef90bf2aec962241b9873934e660258d3efb3de0afbafe0a4d3104d84a6ca53fd4a4e3cdc6bcd0df1c46f0b3d1e55cd18e399f5
6
+ metadata.gz: 51c5f163f99d023570b1affa3030700aa0a0880a0006cd12b16a0c60f1a78cd800760182208a232ee04ece98eb82b2c4e5967a4999be262efdfb2c2cb5705355
7
+ data.tar.gz: 594b2ee9346e954f7d7d9fb9c254cb9439017ac0958d4036bf3704df4b6eedc2070335f01d5cc8b72f0d35c3304226eb369bc3e8dbf962e47c3b18d70937a1c1
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- yaml-translator (0.9.2)
4
+ yaml-translator (0.10.0)
5
5
  diff-lcs
6
6
  easy_translate
7
7
 
@@ -1,4 +1,5 @@
1
1
  require 'yaml'
2
+ require 'psych'
2
3
  require 'ostruct'
3
4
  require 'diff/lcs'
4
5
 
@@ -64,12 +65,12 @@ module YamlTranslator
64
65
  target_locale.merge(self)
65
66
  end
66
67
 
67
- def save(dir=Dir.pwd)
68
- write_file(File.join(dir, "#{lang}.yml"))
68
+ def save(dir=Dir.pwd, options={})
69
+ write_file(File.join(dir, "#{lang}.yml"), options)
69
70
  end
70
71
 
71
- def save_to(dir)
72
- save(dir)
72
+ def save_to(dir, options={})
73
+ save(dir, options)
73
74
  end
74
75
 
75
76
  # Covert to a flatten hash
@@ -78,7 +79,12 @@ module YamlTranslator
78
79
  end
79
80
 
80
81
  def to_s
81
- YAML.dump(Hash[*[lang.to_s, locale_texts]])
82
+ to_yaml
83
+ end
84
+
85
+ def to_yaml(options={})
86
+ p options
87
+ Hash[*[lang.to_s, locale_texts]].to_yaml(options)
82
88
  end
83
89
 
84
90
  private
@@ -122,8 +128,8 @@ module YamlTranslator
122
128
  result
123
129
  end
124
130
 
125
- def write_file(file_path)
126
- File.write(file_path, to_s)
131
+ def write_file(file_path, options={})
132
+ File.write(file_path, to_yaml(options))
127
133
  end
128
134
  end
129
135
  end
@@ -1,3 +1,3 @@
1
1
  module YamlTranslator
2
- VERSION = '0.9.2'
2
+ VERSION = '0.10.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yaml-translator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noritaka Horio