Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

SyntaxSuggest.valid_without?

valid_without?(without_lines:, code_lines:)

SyntaxSuggest.valid_without? [Private]

This will tell you if the code_lines would be valid if you removed the without_lines. In short it’s a way to detect if we’ve found the lines with syntax errors in our document yet.

code_lines = [
  CodeLine.new(line: "def foo\n",   index: 0)
  CodeLine.new(line: "  def bar\n", index: 1)
  CodeLine.new(line: "end\n",       index: 2)
]

SyntaxSuggest.valid_without?(
  without_lines: code_lines[1],
  code_lines: code_lines
)                                    # => true

SyntaxSuggest.valid?(code_lines) # => false
See also .valid? #detailed_message .record_dir also in 4.0 · 3.4 · 3.3