diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb index 50764510f3..6843e6c3d0 100644 --- a/lib/rdoc/markup/attribute_manager.rb +++ b/lib/rdoc/markup/attribute_manager.rb @@ -147,13 +147,7 @@ def convert_attrs(str, attrs, exclusive = false) def convert_attrs_matching_word_pairs(str, attrs, exclusive) # first do matching ones tags = @matching_word_pairs.select { |start, bitmap| - if exclusive && exclusive?(bitmap) - true - elsif !exclusive && !exclusive?(bitmap) - true - else - false - end + exclusive == exclusive?(bitmap) }.keys return if tags.empty? all_tags = @matching_word_pairs.keys @@ -176,11 +170,7 @@ def convert_attrs_word_pair_map(str, attrs, exclusive) # then non-matching unless @word_pair_map.empty? then @word_pair_map.each do |regexp, attr| - if !exclusive - next if exclusive?(attr) - else - next if !exclusive?(attr) - end + next unless exclusive == exclusive?(attr) 1 while str.gsub!(regexp) { |orig| updated = attrs.set_attrs($`.length + $1.length, $2.length, attr) if updated @@ -198,13 +188,7 @@ def convert_attrs_word_pair_map(str, attrs, exclusive) def convert_html(str, attrs, exclusive = false) tags = @html_tags.select { |start, bitmap| - if exclusive && exclusive?(bitmap) - true - elsif !exclusive && !exclusive?(bitmap) - true - else - false - end + exclusive == exclusive?(bitmap) }.keys.join '|' 1 while str.gsub!(/<(#{tags})>(.*?)<\/\1>/i) { |orig| @@ -221,11 +205,7 @@ def convert_html(str, attrs, exclusive = false) def convert_regexp_handlings str, attrs, exclusive = false @regexp_handlings.each do |regexp, attribute| - if exclusive - next if !exclusive?(attribute) - else - next if exclusive?(attribute) - end + next unless exclusive == exclusive?(attribute) str.scan(regexp) do capture = $~.size == 1 ? 0 : 1 diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb index df86d7f452..075f4a072b 100644 --- a/lib/rdoc/parser/c.rb +++ b/lib/rdoc/parser/c.rb @@ -1015,7 +1015,8 @@ def handle_method(type, var_name, meth_name, function, param_count, elsif p_count == -1 then # argc, argv rb_scan_args body else - "(#{(1..p_count).map { |i| "p#{i}" }.join ', '})" + args = (1..p_count).map { |i| "p#{i}" } + "(#{args.join ', '})" end diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index b3026b14ca..ef8ad91668 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -921,7 +921,7 @@ def test_parse_class_lower_name_warning @parser.parse_class @top_level, RDoc::Parser::Ruby::NORMAL, tk, @comment end err = stds[1] - assert_match(/Expected class name or '<<'\. Got/, err) + assert_match(/Expected class name or '<<\'\. Got/, err) end def test_parse_syntax_error_code