instance method
SyntaxSuggest::CleanDocument#take_while_including
take_while_including(range = 0..) { |line)| ... }
lib/syntax_suggest/clean_document.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/syntax_suggest/clean_document.rb, line 296
def take_while_including(range = 0..)
take_next_and_stop = false
@document[range].take_while do |line|
next if take_next_and_stop
take_next_and_stop = !(yield line)
true
end
end
Helper method for grabbing elements from document
Like take_while except when it stops iterating, it also returns the line that caused it to stop