Sha256: 1ae621d4b0a6dde8b6bd1c0504637576d2c1cc15ed323ae25fdc351b069c80b0

Contents?: true

Size: 1.61 KB

Versions: 102

Compression:

Stored size: 1.61 KB

Contents

##
# Generates ri data files

class RDoc::Generator::RI

  RDoc::RDoc.add_generator self

  ##
  # Description of this generator

  DESCRIPTION = 'creates ri data files'

  ##
  # Set up a new ri generator

  def initialize options #:not-new:
    @options     = options
    @old_siginfo = nil
    @current     = nil

    @store          = RDoc::RI::Store.new '.'
    @store.dry_run  = @options.dry_run
    @store.encoding = @options.encoding if @options.respond_to? :encoding
  end

  ##
  # Build the initial indices and output objects based on an array of TopLevel
  # objects containing the extracted information.

  def generate top_levels
    install_siginfo_handler

    @store.load_cache

    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

  ##
  # Installs a siginfo handler that prints the current filename.

  def install_siginfo_handler
    return unless Signal.list.key? 'INFO'

    @old_siginfo = trap 'INFO' do
      puts @current if @current
    end
  end

  ##
  # Removes a siginfo handler and replaces the previous

  def remove_siginfo_handler
    return unless Signal.list.key? 'INFO'

    handler = @old_siginfo || 'DEFAULT'

    trap 'INFO', handler
  end

end

Version data entries

102 entries across 80 versions & 20 rubygems

Version Path
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.1/lib/rdoc/generator/ri.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
active_mailer-0.0.9 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.1/lib/rdoc/generator/ri.rb
active_mailer-0.0.8 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.1/lib/rdoc/generator/ri.rb
active_mailer-0.0.7 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.1/lib/rdoc/generator/ri.rb
active_mailer-0.0.6 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.1/lib/rdoc/generator/ri.rb
font-awesome-rails-3.1.1.2 vendor/ruby/1.9.1/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
font-awesome-rails-3.1.1.2 vendor/ruby/2.0.0/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
font-awesome-rails-3.1.1.1 vendor/ruby/1.9.1/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
font-awesome-rails-3.1.1.1 vendor/ruby/2.0.0/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
challah-1.0.0.beta3 vendor/bundle/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
fc-webicons-0.0.4 vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
challah-1.0.0.beta2 vendor/bundle/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
challah-1.0.0.beta vendor/bundle/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
challah-1.0.0.beta vendor/bundle/gems/rdoc-3.12/lib/rdoc/generator/ri.rb
fc-webicons-0.0.3 vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
fc-webicons-0.0.2 vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
fc-webicons-0.0.1 vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.2/lib/rdoc/generator/ri.rb
rdoc-3.12.2 lib/rdoc/generator/ri.rb
active_mailer-0.0.5 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/rdoc-3.12.1/lib/rdoc/generator/ri.rb