Method: Ditz::ModelObject.from

Defined in:
lib/ditz/model.rb

.from(fn) ⇒ Object



170
171
172
173
174
175
# File 'lib/ditz/model.rb', line 170

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=
  end
end