instance method
SyntaxSuggest::CodeBlock#<=>
<=>(other)
lib/syntax_suggest/code_block.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/syntax_suggest/code_block.rb, line 59
def <=>(other)
out = current_indent <=> other.current_indent
return out if out != 0
# Stable sort
starts_at <=> other.starts_at
end
This is used for frontier ordering, we are searching from the largest indentation to the smallest. This allows us to populate an array with multiple code blocks then call sort! on it without having to specify the sorting criteria