Exception: CSVUtils::UnsortedFileError

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

Overview

Raised by CSVCompare when a file isn't sorted the way its compare block expects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, lineno) ⇒ UnsortedFileError

Returns a new instance of UnsortedFileError.

Parameters:

  • file (String)
  • lineno (Integer)


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

def initialize(file, lineno)
  @file = file
  @lineno = lineno
  super("#{file} isn't sorted: the record on line #{lineno} sorts before the one above it")
end

Instance Attribute Details

#file ⇒ String (readonly)

Returns path of the file.

Returns:

  • (String) —

    path of the file



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

def file
  @file
end

#lineno ⇒ Integer (readonly)

Returns physical line of the first record out of order.

Returns:

  • (Integer) —

    physical line of the first record out of order



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

def lineno
  @lineno
end