Tracks which lines various code blocks have expanded to and which are still unexplored
Class Methods
lib/syntax_suggest/unvisited_lines.rb
View on GitHub
# File tmp/rubies/ruby-3.4.0-preview1/lib/syntax_suggest/unvisited_lines.rb, line 7
def initialize(code_lines:)
@unvisited = code_lines.sort_by(&:indent_index)
@visited_lines = {}
@visited_lines.compare_by_identity
end
No documentation available
Instance Methods
#
lib/syntax_suggest/unvisited_lines.rb
View on GitHub
# File tmp/rubies/ruby-3.4.0-preview1/lib/syntax_suggest/unvisited_lines.rb, line 13
def empty?
@unvisited.empty?
end
No documentation available
#
lib/syntax_suggest/unvisited_lines.rb
View on GitHub
# File tmp/rubies/ruby-3.4.0-preview1/lib/syntax_suggest/unvisited_lines.rb, line 17
def peek
@unvisited.last
end
No documentation available
#
lib/syntax_suggest/unvisited_lines.rb
View on GitHub
# File tmp/rubies/ruby-3.4.0-preview1/lib/syntax_suggest/unvisited_lines.rb, line 21
def pop
@unvisited.pop
end
No documentation available
lib/syntax_suggest/unvisited_lines.rb
View on GitHub
# File tmp/rubies/ruby-3.4.0-preview1/lib/syntax_suggest/unvisited_lines.rb, line 25
def visit_block(block)
block.lines.each do |line|
next if @visited_lines[line]
@visited_lines[line] = true
end
while @visited_lines[@unvisited.last]
@unvisited.pop
end
end
No documentation available