Skip to content

Commit 9f5fcdd

Browse files
committed
RDoc::Options#exclude should return regexp or nil
1 parent b33f2e8 commit 9f5fcdd

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

lib/rdoc/options.rb

+16-8
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class RDoc::Options
164164
##
165165
# Files matching this pattern will be excluded
166166

167-
attr_accessor :exclude
167+
attr_writer :exclude
168168

169169
##
170170
# The list of files to be processed
@@ -493,6 +493,20 @@ def encode_with coder # :nodoc:
493493
end
494494
end
495495

496+
##
497+
# Create a regexp for #exclude
498+
499+
def exclude
500+
if @exclude.nil? or Regexp === @exclude then
501+
# done, #finish is being re-run
502+
@exclude
503+
elsif @exclude.empty? then
504+
nil
505+
else
506+
Regexp.new(@exclude.join("|"))
507+
end
508+
end
509+
496510
##
497511
# Completes any unfinished option setup business such as filtering for
498512
# existent files, creating a regexp for #exclude and setting a default
@@ -505,13 +519,7 @@ def finish
505519
root = @root.to_s
506520
@rdoc_include << root unless @rdoc_include.include?(root)
507521

508-
if @exclude.nil? or Regexp === @exclude then
509-
# done, #finish is being re-run
510-
elsif @exclude.empty? then
511-
@exclude = nil
512-
else
513-
@exclude = Regexp.new(@exclude.join("|"))
514-
end
522+
@exclude = self.exclude
515523

516524
finish_page_dir
517525

0 commit comments

Comments
 (0)