class RDoc::Generator::RI

def self.for options

def self.for options
  new options
end

def generate top_levels

def generate top_levels
  install_siginfo_handler
  RDoc::TopLevel.all_classes_and_modules.each do |klass|
    @current = "#{klass.class}: #{klass.full_name}"
    @store.save_class klass
    klass.each_method do |method|
      @current = "#{method.class}: #{method.full_name}"
      @store.save_method klass, method
    end
    klass.each_attribute do |attribute|
      @store.save_method klass, attribute
    end
  end
  @current = 'saving cache'
  @store.save_cache
ensure
  @current = nil
  remove_siginfo_handler
end

def initialize options #:not-new:

:not-new:
def initialize options #:not-new:
  @options     = options
  @store       = RDoc::RI::Store.new '.'
  @old_siginfo = nil
  @current     = nil
end

def install_siginfo_handler

def install_siginfo_handler
  return unless Signal.list.key? 'INFO'
  @old_siginfo = trap 'INFO' do
    puts @current if @current
  end
end

def remove_siginfo_handler

def remove_siginfo_handler
  return unless Signal.list.key? 'INFO'
  handler = @old_siginfo || 'DEFAULT'
  trap 'INFO', handler
end