Class: LiquidXlsx::Validation::Issue

Inherits:
Struct
  • Object
show all
Defined in:
lib/liquid_xlsx/validation/issue.rb

Overview

A single problem found in a template.

code is a stable machine-readable symbol: host applications map it to their own localized text, so the English message here is a fallback for logs and specs, never the only thing a user can be shown.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cellObject

Returns the value of attribute cell

Returns:

  • (Object)

    the current value of cell



10
11
12
# File 'lib/liquid_xlsx/validation/issue.rb', line 10

def cell
  @cell
end

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



10
11
12
# File 'lib/liquid_xlsx/validation/issue.rb', line 10

def code
  @code
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



10
11
12
# File 'lib/liquid_xlsx/validation/issue.rb', line 10

def message
  @message
end

#rowObject

Returns the value of attribute row

Returns:

  • (Object)

    the current value of row



10
11
12
# File 'lib/liquid_xlsx/validation/issue.rb', line 10

def row
  @row
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



10
11
12
# File 'lib/liquid_xlsx/validation/issue.rb', line 10

def severity
  @severity
end

#sheetObject

Returns the value of attribute sheet

Returns:

  • (Object)

    the current value of sheet



10
11
12
# File 'lib/liquid_xlsx/validation/issue.rb', line 10

def sheet
  @sheet
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



10
11
12
# File 'lib/liquid_xlsx/validation/issue.rb', line 10

def source
  @source
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/liquid_xlsx/validation/issue.rb', line 12

def error?
  severity == :error
end

#locationObject

Human-readable location: "Sheet1!B12", "Sheet1 row 12" or "Sheet1".



21
22
23
24
25
26
27
28
# File 'lib/liquid_xlsx/validation/issue.rb', line 21

def location
  return nil unless sheet

  return "#{sheet}!#{cell}" if cell
  return "#{sheet} row #{row}" if row

  sheet
end

#to_hObject



30
31
32
33
# File 'lib/liquid_xlsx/validation/issue.rb', line 30

def to_h
  { code: code, severity: severity, sheet: sheet, row: row, cell: cell,
    message: message, source: source }
end

#warning?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/liquid_xlsx/validation/issue.rb', line 16

def warning?
  severity == :warning
end