Class: Spreadsheet::Excel::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/spreadsheet/excel/error.rb

Overview

This class encapsulates Excel Error-Codes

Constant Summary collapse

ERROR_VALUES =
{
  0x00 => '#NULL!',  # Intersection of two cell ranges is empty
  0x07 => '#DIV/0!', # Division by zero
  0x0F => '#VALUE!', # Wrong type of operand
  0x17 => '#REF!',   # Illegal or deleted cell reference
  0x1D => '#NAME?',  # Wrong function or range name
  0x24 => '#NUM!',   # Value range overflow
  0x2A => '#N/A!',   # Argument or function not available
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code) ⇒ Error

Argument or function not available


16
17
18
# File 'lib/spreadsheet/excel/error.rb', line 16

def initialize code
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code


6
7
8
# File 'lib/spreadsheet/excel/error.rb', line 6

def code
  @code
end

Instance Method Details

#valueObject

The String value Excel associates with an Error code


21
22
23
# File 'lib/spreadsheet/excel/error.rb', line 21

def value
  ERROR_VALUES.fetch @code, '#UNKNOWN'
end