class RDoc::RI::Store
def save_class klass
def save_class klass FileUtils.mkdir_p class_path(klass.full_name) @cache[:modules] << klass.full_name path = class_file klass.full_name begin disk_klass = nil open path, 'rb' do |io| disk_klass = Marshal.load io.read end klass.merge disk_klass rescue Errno::ENOENT end # BasicObject has no ancestors ancestors = klass.ancestors.compact.map do |ancestor| # HACK for classes we don't know about (class X < RuntimeError) String === ancestor ? ancestor : ancestor.full_name end @cache[:ancestors][klass.full_name] ||= [] @cache[:ancestors][klass.full_name].push(*ancestors) attributes = klass.attributes.map do |attribute| "#{attribute.type} #{attribute.name}" end unless attributes.empty? then @cache[:attributes][klass.full_name] ||= [] @cache[:attributes][klass.full_name].push(*attributes) end open path, 'wb' do |io| Marshal.dump klass, io end end