Skip to content

Commit

Permalink
fix: return token_stream.to_s when token_stream is nil
Browse files Browse the repository at this point in the history
The change in ruby#1055 might be a breaking change.
So, just simply return `token_stream.to_s` when it's nil
  • Loading branch information
toshimaru committed Nov 19, 2023
1 parent 72897d3 commit 7ad174c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/rdoc/token_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ def pop_token
# Current token stream

def token_stream
@token_stream || []
@token_stream
end

##
# Returns a string representation of the token stream

def tokens_to_s
return token_stream.to_s unless token_stream

token_stream.compact.map { |token| token[:text] }.join ''
end

Expand Down

0 comments on commit 7ad174c

Please sign in to comment.