Configuration.new doesn't work with nested hashes
ineu opened this issue · comments
Eugene Diachkin commented
I'm trying to use Confstruct like
yaml = YAML.load_file 'application.yml'
config = Confstruct::Configuration.new yaml
When yaml contains nested hashes, it's not possible to reach inner members. But if i set inner member by hands, it works:
irb(main):001:0> require 'confstruct'
=> true
irb(main):002:0> x = {'a' => {'b' => 'c'}}
=> {"a"=>{"b"=>"c"}}
irb(main):003:0> config = Confstruct::Configuration.new x
=> {:a=>{"b"=>nil}}
irb(main):004:0> config[:a]['d'] = 'e'
=> "e"
irb(main):005:0> config
=> {:a=>{"b"=>nil, :d=>"e"}}
Michael B. Klein commented
Thanks for finding this -- it seems to be an issue with stringified hash keys, which I didn't have a test for. I've just released v0.2.1 to address this.