Module: ErrorHighlight
- Defined in:
- lib/error_highlight/base.rb,
lib/error_highlight/version.rb,
lib/error_highlight/core_ext.rb,
lib/error_highlight/formatter.rb
Defined Under Namespace
Modules: CoreExt Classes: DefaultFormatter
Constant Summary collapse
- VERSION =
"0.3.0"
Class Method Summary collapse
- .formatter ⇒ Object
- .formatter=(formatter) ⇒ Object
-
.spot ⇒ Object
Identify the code fragment that seems associated with a given error.
Class Method Details
.formatter ⇒ Object
16 17 18 |
# File 'lib/error_highlight/formatter.rb', line 16 def self.formatter Ractor.current[:__error_highlight_formatter__] || DefaultFormatter end |
.formatter=(formatter) ⇒ Object
20 21 22 |
# File 'lib/error_highlight/formatter.rb', line 20 def self.formatter=(formatter) Ractor.current[:__error_highlight_formatter__] = formatter end |
.spot ⇒ Object
Identify the code fragment that seems associated with a given error
Arguments:
node: RubyVM::AbstractSyntaxTree::Node (script_lines should be enabled)
point_type: :name | :args
name: The name associated with the NameError/NoMethodError
Returns:
{
first_lineno: Integer,
first_column: Integer,
last_lineno: Integer,
last_column: Integer,
snippet: String,
} | nil
19 20 21 |
# File 'lib/error_highlight/base.rb', line 19 def self.spot(...) Spotter.new(...).spot end |