3 $:.unshift(File.expand_path("../lib", __dir__))
6 # Make only the output directory relative to the invoked directory.
9 # Load options and parse files from srcdir.
10 Dir.chdir(File.dirname(__dir__))
12 options = RDoc::Options.load_options
13 options.title = options.title.sub(/Ruby \K.*version/) {
14 File.read("include/ruby/version.h")
15 .scan(/^ *# *define +RUBY_API_VERSION_(MAJOR|MINOR) +(\d+)/)
16 .sort # "MAJOR" < "MINOR", fortunately
17 .to_h.values.join(".")
21 options.singleton_class.define_method(:finish) do
23 @op_dir = File.expand_path(@op_dir, invoked)
26 # Do not hide errors when generating documents of Ruby itself.
27 RDoc::RDoc.new.document options