Exception: CSVUtils::HeaderNotFoundError

Inherits:
RuntimeError
  • Object
show all
Includes:
Error
Defined in:
lib/csv_utils/header_not_found_error.rb

Overview

Raised when a header the caller named isn't in the file. A RuntimeError, as before this class existed.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header, headers) ⇒ HeaderNotFoundError

Returns a new instance of HeaderNotFoundError.

Parameters:

  • header (String)
  • headers (Array<String>)


15
16
17
18
19
# File 'lib/csv_utils/header_not_found_error.rb', line 15

def initialize(header, headers)
  @header = header
  @headers = headers
  super("header #{header} not found in #{headers}")
end

Instance Attribute Details

#header ⇒ String (readonly)

Returns the header that wasn't found.

Returns:

  • (String) —

    the header that wasn't found



9
10
11
# File 'lib/csv_utils/header_not_found_error.rb', line 9

def header
  @header
end

#headers ⇒ Array<String> (readonly)

Returns the headers of the file.

Returns:

  • (Array<String>) —

    the headers of the file



11
12
13
# File 'lib/csv_utils/header_not_found_error.rb', line 11

def headers
  @headers
end