tolk 3.0.1 → 3.0.2

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
  SHA256:
3
- metadata.gz: 13d8d26b2098b0ae5b40b1a283d50d6cb099f8d83ce6630a7d1807e669e7e864
4
- data.tar.gz: b5d904bee635dc8271da82a1dca6e1a487696ecd68d5b99cc38169ed6491f6cf
3
+ metadata.gz: a3b8241abe4dc3fb29b314cc2d10706ed44d87534bfca91938274f22b2efb6c3
4
+ data.tar.gz: ece4b7e9dd20ee3729a3ef3151fafd79e1aa24d1d7a87755d868853e3bf93b5e
5
5
  SHA512:
6
- metadata.gz: faa81169ad3e11e3cd4a53443e58a0ce884f1cf81657b0cf257129b81fa72211d414e89e7b45104d1f68486695f82695da0e5c2fe8746c123698aa7fcde8efd1
7
- data.tar.gz: e052ecc99b90cc40fe7dd5626a52da884bf4ef67758b2b189c37b21b2be0736c255cb4d58af8a5dc67d7b19aadb7770188fa7c199e48620672121a2a6f03828c
6
+ metadata.gz: a61d50cc51fc2902366b8a3afd1da39fbaebcb9b8ffdde5a7978252b492be160a11c0e6b3561637c750590cb2357ea954a78afe86cfced76c31f225df6ecfa84
7
+ data.tar.gz: 8c0f00f1862c654e5d55b59ad6c5579e5ea83068ff8dfe965c8453195f0d599b82ed9266aa032f1b35a8b600626190003b41ee615ccdddc21ced81bac0076867
@@ -153,14 +153,14 @@ module Tolk
153
153
  end
154
154
 
155
155
  def to_hash
156
- data = translations.includes(:phrase).references(:phrases).order(phrases.arel_table[:key]).
157
- each_with_object({}) do |translation, locale|
158
- if translation.phrase.key.include?(".")
159
- locale.deep_merge!(unsquish(translation.phrase.key, translation.value))
160
- else
161
- locale[translation.phrase.key] = translation.value
162
- end
156
+ data = translations.joins(:phrase).order("tolk_phrases.key ASC").pluck("tolk_phrases.key, text").
157
+ each_with_object(Hash.new(0)) do |translation, locale|
158
+ if translation[0].include?(".")
159
+ locale.deep_merge!(unsquish(translation[0], translation[1]))
160
+ else
161
+ locale[translation[0]] = translation[1]
163
162
  end
163
+ end
164
164
  { name => data }
165
165
  end
166
166
 
@@ -23,6 +23,9 @@ module Tolk
23
23
  # strip translation texts automatically
24
24
  attr_accessor :strip_texts
25
25
 
26
+ # specify line width which Yaml.dump will use to break lines. -1 for not breaking
27
+ attr_accessor :yaml_line_width
28
+
26
29
  def reset
27
30
  @exclude_gems_token = false
28
31
 
@@ -78,6 +81,8 @@ module Tolk
78
81
  'zh-CN' => 'Chinese (Simplified)',
79
82
  'zh-TW' => 'Chinese (Traditional)'
80
83
  }
84
+
85
+ @yaml_line_width = Psych::Handler::OPTIONS.line_width # Psych::Handler::DumperOptions uses 0 as "default" for unset
81
86
  end
82
87
  end
83
88
 
@@ -1,3 +1,3 @@
1
1
  module Tolk
2
- VERSION = "3.0.1"
2
+ VERSION = "3.0.2"
3
3
  end
@@ -22,7 +22,7 @@ module Tolk
22
22
  if payload.respond_to?(:ya2yaml)
23
23
  payload.ya2yaml(:syck_compatible => true)
24
24
  else
25
- ::YAML.dump(payload)
25
+ ::YAML.dump(payload, line_width: Tolk::Config.yaml_line_width)
26
26
  end
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tolk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2017-11-23 00:00:00.000000000 Z
15
+ date: 2018-03-19 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: rails
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
179
179
  version: '0'
180
180
  requirements: []
181
181
  rubyforge_project:
182
- rubygems_version: 2.7.2
182
+ rubygems_version: 2.7.6
183
183
  signing_key:
184
184
  specification_version: 4
185
185
  summary: Rails engine providing web interface for managing i18n yaml files