dtao/safe_yaml

merges fail with empty common block

ccutrer opened this issue · 0 comments

require 'yaml'
require 'safe_yaml'

yaml = <<-YAML
defaults: &defaults

development:
  <<: *defaults
YAML

YAML.load(yaml) # TypeError: no implicit conversion of nil into Hash
#   from /Users/cody/.gem/ruby/2.2.3/gems/safe_yaml-1.0.4/lib/safe_yaml/psych_handler.rb:42:in `merge!'

it also fails with syck:

require 'yaml'
require 'syck'
require 'safe_yaml'

yaml = <<-YAML
defaults: &defaults

development:
  <<: *defaults
YAML

YAML.load(yaml) # NoMethodError: undefined method `each' for nil:NilClass
#   from /Users/cody/.gem/ruby/2.2.3/gems/safe_yaml-1.0.4/lib/safe_yaml/resolver.rb:89:in `merge_into_hash'