Class: Herb::Errors::StrictLocalsSplatArgumentError

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 collapse

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, #to_json

Constructor Details

#initialize(type, location, message, name) ⇒ StrictLocalsSplatArgumentError

: (String, Location?, String, String) -> void



1348
1349
1350
1351
# File 'lib/herb/errors.rb', line 1348

def initialize(type, location, message, name)
  super(type, location, message)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

| name: String?, | }



1345
1346
1347
# File 'lib/herb/errors.rb', line 1345

def name
  @name
end

Instance Method Details

#inspectObject

: () -> String



1354
1355
1356
# File 'lib/herb/errors.rb', line 1354

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

#to_hashObject

: () -> serialized_strict_locals_splat_argument_error



1359
1360
1361
1362
1363
# File 'lib/herb/errors.rb', line 1359

def to_hash
  super.merge(
    name: name
  ) #: Herb::serialized_strict_locals_splat_argument_error
end

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

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



1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
# File 'lib/herb/errors.rb', line 1366

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 += white("└── name: #{green(name.inspect)}\n")
  output += %(\n)

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