class RSpec::Support::Source::Token

def keyword_closed_by?(other)

def keyword_closed_by?(other)
  return false unless keyword?
  return true if other.string == CLOSING_KEYWORDS_BY_OPENING_KEYWORD[string]
  # Ruby 3's `end`-less method definition: `def method_name = body`
  string == 'def' && other.equals_operator? && location.line == other.location.line
end