Capture parse errors from ripper
Example:
puts RipperErrors.new(" def foo").call.errors # => ["syntax error, unexpected end-of-input, expecting ';' or '\\n'"]
Attributes
Read
No documentation available
Instance Methods
#
lib/syntax_suggest/ripper_errors.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/syntax_suggest/ripper_errors.rb, line 27
def call
@run_once ||= begin
@errors = []
parse
true
end
self
end
No documentation available
lib/syntax_suggest/ripper_errors.rb
View on GitHub
An alias for on_parse_error
lib/syntax_suggest/ripper_errors.rb
View on GitHub
An alias for on_parse_error
lib/syntax_suggest/ripper_errors.rb
View on GitHub
An alias for on_parse_error
lib/syntax_suggest/ripper_errors.rb
View on GitHub
An alias for on_parse_error
lib/syntax_suggest/ripper_errors.rb
View on GitHub
# File tmp/rubies/ruby-3.2.0/lib/syntax_suggest/ripper_errors.rb, line 16
def on_parse_error(msg)
@errors ||= []
@errors << msg
end
Comes from ripper, called on every parse error, msg is a string