Skip to content

Commit

Permalink
rdoc: suppress warnings in eval
Browse files Browse the repository at this point in the history
* lib/rdoc/markup/to_html.rb (RDoc::Markup::ToHtml): the argument
  text may contain warnings, which are useless to check if
  parseable.  merge rdoc/rdoc#440.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57548 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Feb 6, 2017
1 parent 65e5321 commit 8401275
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/rdoc/markup/to_html.rb
Expand Up @@ -383,9 +383,12 @@ def list_end_for(list_type)
# Returns true if text is valid ruby syntax

def parseable? text
verbose, $VERBOSE = $VERBOSE, nil
eval("BEGIN {return true}\n#{text}")
rescue SyntaxError
false
ensure
$VERBOSE = verbose
end

##
Expand Down

0 comments on commit 8401275

Please sign in to comment.