@@ -71,7 +71,7 @@ class RDoc::Options
7171 attr_accessor :formatter
7272
7373 ##
74- # Description of the output generator (set with the <tt>-fmt</tt> option)
74+ # Description of the output generator (set with the <tt>-- fmt</tt> option)
7575
7676 attr_accessor :generator
7777
@@ -246,6 +246,35 @@ def default_title=(string)
246246 @title ||= string
247247 end
248248
249+ ##
250+ # Completes any unfinished option setup business such as filtering for
251+ # existent files, creating a regexp for #exclude and setting a default
252+ # #template.
253+
254+ def finish
255+ @op_dir ||= 'doc'
256+
257+ @rdoc_include << "." if @rdoc_include . empty?
258+
259+ if @exclude . empty? then
260+ @exclude = nil
261+ else
262+ @exclude = Regexp . new ( @exclude . join ( "|" ) )
263+ end
264+
265+ check_files
266+
267+ # If no template was specified, use the default template for the output
268+ # formatter
269+
270+ unless @template then
271+ @template = @generator_name
272+ @template_dir = template_dir_for @template
273+ end
274+
275+ self
276+ end
277+
249278 ##
250279 # Returns a properly-space list of generators and their descriptions.
251280
@@ -273,7 +302,7 @@ def generator_descriptions
273302 end
274303
275304 ##
276- # Parse command line options.
305+ # Parses command line options.
277306
278307 def parse ( argv )
279308 ignore_invalid = true
@@ -677,26 +706,9 @@ def parse(argv)
677706 end
678707 end
679708
680- @op_dir ||= 'doc'
681709 @files = argv . dup
682710
683- @rdoc_include << "." if @rdoc_include . empty?
684-
685- if @exclude . empty? then
686- @exclude = nil
687- else
688- @exclude = Regexp . new ( @exclude . join ( "|" ) )
689- end
690-
691- check_files
692-
693- # If no template was specified, use the default template for the output
694- # formatter
695-
696- unless @template then
697- @template = @generator_name
698- @template_dir = template_dir_for @template
699- end
711+ finish
700712 end
701713
702714 ##
0 commit comments