Skip to content

Fix wrong use of =~ #674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/rdoc/markup/to_markdown.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def accept_verbatim verbatim
@res << part
end

@res << "\n" unless @res =~ /\n\z/
@res << "\n"
end

##
Expand Down
2 changes: 1 addition & 1 deletion lib/rdoc/markup/to_rdoc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def accept_verbatim verbatim
@res << part
end

@res << "\n" unless @res =~ /\n\z/
@res << "\n"
end

##
Expand Down
24 changes: 16 additions & 8 deletions lib/rdoc/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class RDoc::Options
##
# Files matching this pattern will be excluded

attr_accessor :exclude
attr_writer :exclude

##
# The list of files to be processed
Expand Down Expand Up @@ -493,6 +493,20 @@ def encode_with coder # :nodoc:
end
end

##
# Create a regexp for #exclude

def exclude
if @exclude.nil? or Regexp === @exclude then
# done, #finish is being re-run
@exclude
elsif @exclude.empty? then
nil
else
Regexp.new(@exclude.join("|"))
end
end

##
# Completes any unfinished option setup business such as filtering for
# existent files, creating a regexp for #exclude and setting a default
Expand All @@ -505,13 +519,7 @@ def finish
root = @root.to_s
@rdoc_include << root unless @rdoc_include.include?(root)

if @exclude.nil? or Regexp === @exclude then
# done, #finish is being re-run
elsif @exclude.empty? then
@exclude = nil
else
@exclude = Regexp.new(@exclude.join("|"))
end
@exclude = self.exclude

finish_page_dir

Expand Down