lib/pears/provider/base.rb in pears-0.1.2 vs lib/pears/provider/base.rb in pears-0.1.3

- old
+ new

@@ -19,12 +19,16 @@ @data[key] end private - def parse_yaml(yaml_data) - yaml_data = YAML.load(yaml_data) - raise Pears::InvalidProviderData unless yaml_data.is_a? Hash + def parse_yaml(yaml_string) + yaml_data = YAML.load(yaml_string) + + unless yaml_data.respond_to? :with_indifferent_access + raise Pears::InvalidProviderData + end + yaml_data.with_indifferent_access rescue Psych::SyntaxError => e logger ||= defined?(Rails) ? Rails.logger : Logger.new(STDOUT) logger.warn "#{e.class} #{e.message}" raise Pears::InvalidProviderData