Class: Herb::Errors::StrictLocalsDuplicateDeclarationError

Inherits:
Error
  • Object
show all
Includes:
Colors
Defined in:
lib/herb/errors.rb,
ext/herb/error_helpers.c

Constant Summary

Constants included from Colors

Colors::CLEAR_SCREEN, Colors::HIDE_CURSOR, Colors::SHOW_CURSOR

Instance Attribute Summary

Attributes inherited from Error

#location, #message, #type

Instance Method Summary collapse

Methods included from Colors

bold, bright_magenta, cyan, dimmed, enabled?, fg, fg_bg, green, magenta, red, white, yellow

Methods inherited from Error

#class_name, #error_name, #initialize, #to_hash, #to_json

Constructor Details

This class inherits a constructor from Herb::Errors::Error

Instance Method Details

#inspectObject

: () -> String



1421
1422
1423
# File 'lib/herb/errors.rb', line 1421

def inspect
  tree_inspect.rstrip.gsub(/\s+$/, "")
end

#tree_inspect(indent: 0, depth: 0, depth_limit: 25) ⇒ Object

: (?indent: Integer, ?depth: Integer, ?depth_limit: Integer) -> String



1426
1427
1428
1429
1430
1431
1432
1433
1434
# File 'lib/herb/errors.rb', line 1426

def tree_inspect(indent: 0, depth: 0, depth_limit: 25)
  output = +""

  output += white("@ #{bold(red(error_name))} #{dimmed("(location: #{location&.tree_inspect})\n")}")
  output += white("└── message: #{green(message.inspect)}\n")
  output += %(\n)

  output.gsub(/^/, "    " * indent)
end