class SyntaxSuggest::RipperErrors

Capture parse errors from ripper

Example:

puts RipperErrors.new(" def foo").call.errors
# => ["syntax error, unexpected end-of-input, expecting ';' or '\\n'"]

Attributes

Public Instance Methods

# File lib/syntax_suggest/ripper_errors.rb, line 27
def call
  @run_once ||= begin
    @errors = []
    parse
    true
  end
  self
end

Comes from ripper, called on every parse error, msg is a string

# File lib/syntax_suggest/ripper_errors.rb, line 16
def on_parse_error(msg)
  @errors ||= []
  @errors << msg
end