lib/entitlements/data/people/yaml.rb in entitlements-0.1.8 vs lib/entitlements/data/people/yaml.rb in entitlements-0.2.0

- old
+ new

@@ -75,10 +75,18 @@ # Returns Hash of { uid => Entitlements::Models::Person } or one Entitlements::Models::Person. Contract C::Maybe[String] => C::Or[Entitlements::Models::Person, C::HashOf[String => Entitlements::Models::Person]] def read(uid = nil) @people ||= begin Entitlements.logger.debug "Loading people from #{filename.inspect}" - raw_person_data = ::YAML.load(File.read(filename)).to_h + + # :nocov: + raw_person_data = if RubyVersionCheck.ruby_version2? + ::YAML.load(File.read(filename)).to_h + else + ::YAML.load(File.read(filename), permitted_classes: [Date]).to_h + end + # :nocov: + raw_person_data.map do |id, data| [id, Entitlements::Models::Person.new(uid: id, attributes: data)] end.to_h end return @people if uid.nil?