Skip to content

Commit 3337e5b

Browse files
committed
Refactor RubyTools#get_tk
1 parent 5abb2e6 commit 3337e5b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/rdoc/parser/ruby_tools.rb

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def get_tk
2020

2121
if @tokens.empty? then
2222
if @scanner_point >= @scanner.size
23-
return nil
23+
return
2424
else
2525
tk = @scanner[@scanner_point]
2626
@scanner_point += 1
@@ -31,16 +31,14 @@ def get_tk
3131
tk = @tokens.shift
3232
end
3333

34-
if tk == nil || :on___end__ == tk[:kind]
35-
tk = nil
34+
if tk.nil? || :on___end__ == tk[:kind]
35+
return
3636
end
3737

38-
return nil unless tk
39-
4038
# inform any listeners of our shiny new token
41-
@token_listeners.each do |obj|
39+
@token_listeners&.each do |obj|
4240
obj.add_token(tk)
43-
end if @token_listeners
41+
end
4442

4543
tk
4644
end

0 commit comments

Comments
 (0)