class LicenseFinder::Decisions
def self.restore(persisted, result = new)
def self.restore(persisted, result = new) return result unless persisted # From https://makandracards.com/makandra/465149-ruby-the-yaml-safe_load-method-hides-some-pitfalls actions = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1') YAML.safe_load(persisted, permitted_classes: [Symbol, Time], aliases: true) else YAML.safe_load(persisted, [Symbol, Time], [], true) end list_of_actions = (actions || []).map(&:first) if (list_of_actions & %i[whitelist blacklist]).any? raise 'The decisions file seems to have whitelist/blacklist keys which are deprecated. Please replace them with permit/restrict respectively and try again! More info - https://github.com/pivotal/LicenseFinder/commit/a40b22fda11b3a0efbb3c0a021381534bc998dd9' end (actions || []).each do |action, *args| result.send(action, *args) end result end