iye 1.0.0 → 1.0.1

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.
data/README.md CHANGED
@@ -42,3 +42,7 @@ The source ships with a `config.ru` suitable for development use with `shotgun(1
42
42
 
43
43
  shotgun -p 5050
44
44
 
45
+ ## Troubleshooting
46
+
47
+ **``psych.rb:203:in `parse': wrong number of arguments(2 for 1) (ArgumentError)``**
48
+ : This is caused by a mismatch of the `psych` in standard library and the gem. The bug is fixed in Ruby 1.9.3-p194.
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "iye"
3
- s.version = "1.0.0"
4
- s.date = "2012-09-18"
3
+ s.version = "1.0.1"
4
+ s.date = "2012-10-03"
5
5
  s.summary = "I18n Yaml Editor"
6
6
  s.email = "hv@firmafon.dk"
7
7
  s.homepage = "http://github.com/firmafon/iye"
@@ -1,6 +1,8 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module I18nYamlEditor
4
+ class TransformationError < StandardError; end
5
+
4
6
  module Transformation
5
7
  def flatten_hash hash, namespace=[], tree={}
6
8
  hash.each {|key, value|
@@ -18,15 +20,19 @@ module I18nYamlEditor
18
20
  def nest_hash hash
19
21
  result = {}
20
22
  hash.each {|key, value|
21
- sub_result = result
22
- keys = key.split(".")
23
- keys.each_with_index {|k, idx|
24
- if keys.size - 1 == idx
25
- sub_result[k.to_sym] = value
26
- else
27
- sub_result = (sub_result[k.to_sym] ||= {})
28
- end
29
- }
23
+ begin
24
+ sub_result = result
25
+ keys = key.split(".")
26
+ keys.each_with_index {|k, idx|
27
+ if keys.size - 1 == idx
28
+ sub_result[k.to_sym] = value
29
+ else
30
+ sub_result = (sub_result[k.to_sym] ||= {})
31
+ end
32
+ }
33
+ rescue => e
34
+ raise TransformationError.new("Failed to nest key: #{key.inspect} with value: #{value.inspect}")
35
+ end
30
36
  }
31
37
  result
32
38
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iye
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-18 00:00:00.000000000 Z
12
+ date: 2012-10-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cuba