instance method
SyntaxSuggest::ExplainSyntax#why
why(miss)
lib/syntax_suggest/explain_syntax.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/syntax_suggest/explain_syntax.rb, line 91
def why(miss)
case miss
when "keyword"
"Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ?"
when "end"
"Unmatched keyword, missing `end' ?"
else
inverse = INVERSE.fetch(miss) {
raise "Unknown explain syntax char or key: #{miss.inspect}"
}
"Unmatched `#{inverse}', missing `#{miss}' ?"
end
end
Converts a missing string to an human understandable explanation.
Example:
Example
explain.why("}") # => "Unmatched `{', missing `}' ?"