Exception: SpreadsheetArchitect::Exceptions::InvalidRangeError

Inherits:
ArgumentError
  • Object
show all
Defined in:
lib/spreadsheet_architect/exceptions.rb

Instance Method Summary collapse

Constructor Details

#initialize(type, range, message: nil) ⇒ InvalidRangeError



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/spreadsheet_architect/exceptions.rb', line 17

def initialize(type, range, message: nil)
  default_msg = "Invalid range `#{range}` passed"

  if message.nil?
    case type
    when :missing_range_keys
      message = "Missing :rows or :columns key"
    when :format
      message = "Format must be as follows: A1:D4"
    when :type
      message = "Valid types are Hash and String"
    end
  end

  super([default_msg, message].compact.join(". "))
end