# File lib/model.rb, line 113 def self.from fn returning YAML::load_file(fn) do |o| raise ModelError, "error loading from yaml file #{fn.inspect}: expected a #{self}, got a #{o.class}" unless o.class == self o.pathname = fn if o.respond_to? :pathname= o.class.fields.each do |f, opts| m = "__serialized_#{f}" if opts[:multi] && o.send(m).nil? $stderr.puts "Warning: corrected nil multi-field #{f}" o.send "#{m}=", [] end end end end