Skip to content

Separate RDoc::TokenStream#add_tokens and #add_token #732

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 1 commit into from
Aug 15, 2019
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
11 changes: 8 additions & 3 deletions lib/rdoc/token_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,16 @@ def self.to_html token_stream
##
# Adds +tokens+ to the collected tokens

def add_tokens(*tokens)
tokens.flatten.each { |token| @token_stream << token }
def add_tokens(tokens)
@token_stream.concat(tokens)
end

alias add_token add_tokens
##
# Adds one +token+ to the collected tokens

def add_token(token)
@token_stream.push(token)
end

##
# Starts collecting tokens
Expand Down
4 changes: 2 additions & 2 deletions test/rdoc/test_rdoc_any_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_markup_code
]

@c2_a.collect_tokens
@c2_a.add_tokens(*tokens)
@c2_a.add_tokens(tokens)

expected = '<span class="ruby-constant">CONSTANT</span>'

Expand All @@ -96,7 +96,7 @@ def test_markup_code_with_line_numbers
]

@c2_a.collect_tokens
@c2_a.add_tokens(*tokens)
@c2_a.add_tokens(tokens)

assert_equal <<-EXPECTED.chomp, @c2_a.markup_code
<span class="ruby-comment"># File xref_data.rb, line 1</span>
Expand Down