# File lib/cgikit/declaration.rb, line 113 def new_from_hash( name, hash ) unless hash.key?(ELEMENT_KEY) then raise "'#{name}' don't define #{ELEMENT_KEY.inspect}." end unless Class === hash[ELEMENT_KEY] then raise "value of '#{ELEMENT_KEY}' must be class." end dec = Declaration.new(name, hash[ELEMENT_KEY]) ass = nil hash.each do |key, value| if Symbol === value then ass = Association.new_with_keypath value else ass = Association.new_with_value value end dec[key] = ass end dec end